添加链接描述
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
string d;
cin>>d>>n;
for(int i=1;i<n;i++){
string p;
char ch=d[0];
int tot=0;
for(int j=0;j<d.size();j++){
if(d[j]==ch){
tot++;
}
else {
p+=ch;
p+=tot+'0';
tot=1;
ch=d[j];
}
}
if(tot)p+=ch,p+=tot+'0';
d=p;
}
cout<<d<<endl;
return 0;
}