You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
481 B
27 lines
481 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
string s;
|
|
cin >> s;
|
|
|
|
int m;
|
|
cin >> m;
|
|
m--;
|
|
|
|
while (m--) {
|
|
string t;
|
|
for (int i = 0; i < s.size(); i++) {
|
|
int c = 1;
|
|
while (i + 1 < s.size() && s[i + 1] == s[i]) {
|
|
c++;
|
|
i++;
|
|
}
|
|
t = t + to_string(c) + s[i];
|
|
}
|
|
s = t;
|
|
}
|
|
cout << s << endl;
|
|
return 0;
|
|
}
|