#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main(void) { string str; int n; while (cin >> str) { cin >> n; while (n--) { for (int i = 0; i < str.size() - 1; i++) { if (str[i] > str[i + 1]) { str.erase(i,1); break; } } } while(str[0] == '0') str.erase(0,1); if(str.size() == 0) cout << "0" << endl; else cout << str << endl; } } |
Double click to view unformatted code.