'commit'
This commit is contained in:
26
TangDou/LanQiaoBei/ZhongGaoJi/LanQiao15STEMA202312/9.cpp
Normal file
26
TangDou/LanQiaoBei/ZhongGaoJi/LanQiao15STEMA202312/9.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user