Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #define Nmax 1000001
- using namespace std;
- int main()
- {
- int k;
- char cuv[Nmax],st[Nmax];
- cin>>k>>cuv;
- unsigned int L=strlen(cuv);
- int vf=0;
- for(unsigned int i=0;i<L;++i)
- {
- while(vf&&k&&st[vf]>cuv[i])
- --vf,--k;
- st[++vf]=cuv[i];
- }
- vf-=k;
- st[vf+1]=0;
- cout<<st+1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement