#include<iostream> #include<string> #include<cstring> using namespace std; int main() { string str; int s; while (cin >> str >> s) { /*if (str.size() == s) { cout << 0 << endl; continue; }*/ while (s--) { for (int i = 0; i < str.size(); i++) { if (str[i] > str[i + 1] || i == str.size() - 1) { str.erase(i, 1); break; } } } int i = 0; for (i = 0; i < str.size(); ) { if (str[i] == '0') { i++; } else break; } if (i < str.size()) cout << str.substr(i) << endl; else cout << 0 << endl; } return 0; } |
Double click to view unformatted code.