#include<bits/stdc++.h> using namespace std; int main(){ int s; string str; while(cin>>str>>s){ 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; for(i=0;i<str.size();i++){ if(str[i]=='0') i++; else break; } if(i<str.size()) cout<<str.substr(i)<<endl; else cout<<0<<endl; } } |
Double click to view unformatted code.