# Arup Guha
# 11/23/2024
# Solution to Run Length Encoding Run
# https://open.kattis.com/problems/runlengthencodingrun

# Get tokens.
toks = input().split()

# For readability
s = toks[1]

# Encode
if toks[0] == "E":

    i = 0
    while i < len(s):

        # Go to next unique char.
        j = i
        while j<len(s) and s[j]==s[i]:
            j += 1

        # Output
        print(s[i],j-i, sep="",end="")

        # Update
        i = j

    print()

# Decode
else:

    # Go in pairs.
    for i in range(0, len(s), 2):

        # Making use of python string multiplication!
        print(s[i]*(ord(s[i+1])-ord('0')), end="")
    print()
