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.
23 lines
515 B
23 lines
515 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int k;
|
|
string kill(string s) {
|
|
int p = s[s.size() - 1]; // 最后一位是默认值
|
|
for (int i = 0; i < s.size() - 1; i++)
|
|
if (s[i + 1] > s[i]) {
|
|
p = i;
|
|
break;
|
|
}
|
|
string res;
|
|
for (int i = 0; i < s.size(); i++)
|
|
if (i != p) res += s[i];
|
|
return res;
|
|
}
|
|
|
|
int main() {
|
|
string s;
|
|
cin >> s >> k;
|
|
for (int i = 1; i <= k; i++) s = kill(s);
|
|
cout << s << endl;
|
|
return 0;
|
|
} |