#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string get_num(string &s){
string sa = "";
for(int i = 0; i < s.length(); i++){
sa.push_back(s[i]);
int cnt = 1;
while(i + 1 < s.length() && s[i + 1] == s[i]){
cnt++;
i++;
}
sa.push_back(cnt + '0');
}
return sa;
}
int main( ){
string s;
int m;
cin >> s >> m;
for(int i = 1; i < m; i++){
s = get_num(s);
}
cout << s << endl;
return 0;
}