#include<iostream>
#include<string>
using namespace std;
int main()
{
char ch;
string s, t;
cin >> ch;
getchar();
getline(cin, s);
int ls = s.length();
if (ch == 'C')
{
for (int i = 0; i < ls; i++)
{
int cnt, j = i + 1;
while (j < ls && s[j] == s[i]) j++;
cnt = j - i;
i += cnt - 1;
if(cnt != 1)
t += to_string(cnt);
t += s[i];
}
cout << t;
}
else
{
for (int i = 0; s[i]; i++) {
if (!isdigit(s[i])) cout << s[i];
else{
int j = i;
string u = "";
while (isdigit(s[j]) && j < ls) {//数字
u += s[j];
j++;
}
if (j < ls) {
for (int k = 0; k < stoi(u); k++) {
cout << s[j];
}
i = j;
}
}
}
}
return 0;
}