模拟
统计连续一段数字技巧:while(j < s.size() && s[j] == s[i]) j ++ ;
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
int n;
cin >> n;
while(n -- )
{
string t;
for(int i = 0;i < s.size();)
{
int j = i;
while(j < s.size() && s[j] == s[i]) j ++ ;
int cnt = j - i;
t += to_string(cnt) + s[i];
i = j;
}
s = t;
}
cout << s << endl;
return 0;
}
很棒
不错子