// Arup Guha
// 10/4/2018
// Solution to 2018 NAQ Problem: Run Length Encoding Run

import java.util.*;

public class runlengthencodingrun_arup {
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		char mode = stdin.next().charAt(0);
		
		// Encode
		if (mode == 'E') {
			
			String plain = stdin.next();
			int i = 0;
			
			// Go through the whole string.
			while (i < plain.length()) {
				
				// Find how many chars match plain[i].
				int j = i;
				while (j < plain.length() && plain.charAt(j) == plain.charAt(i)) j++;
				
				// Print this pair.
				System.out.print(""+plain.charAt(i)+(j-i));
				
				// Advance...
				i = j;
			}
			System.out.println();
		}
		
		// Decode
		else {
			
			String code = stdin.next();
			
			// Process pairs of characters.
			for (int i=0; i<code.length(); i+=2) {
				
				// Count repetitions.
				int rep = code.charAt(i+1) - '0';
				
				// Print them.
				for (int j=0; j<rep; j++)
					System.out.print(code.charAt(i));
			}
			System.out.println();
		}
	}
}
