https://pintia.cn/problem-sets/994805260223102976/problems/994805262018265088
#include <iostream>
#include <string>
using namespace std;
int main(){
char order, tmpc;
string s;
cin >> order;
getchar();
getline(cin, s);
if(order == 'C'){
int cnt = 0;
tmpc = s[0];
for(int i = 0; i < s.size(); i++){
if(s[i] != tmpc){
if(cnt > 1) cout << cnt;
cout << tmpc;
tmpc = s[i];
cnt = 1;
}
else
cnt++;
}
if(cnt > 1) cout << cnt;
cout << tmpc;
}else{
int count = 0;
for(int i = 0; i < s.size(); i++){
if(s[i] <= '9' && s[i] >= '0')
count = count*10 + s[i]-'0';
else if(!count) cout << s[i];
else{
while(count--)
cout << s[i];
count = 0;
}
}
}
return 0;
}