#include <iostream>
usingnamespace std;
void Func(char ver[],constint COUNT)
{
int LEN=strlen(ver);
int len=LEN;
int count=0;
int pos=0;
while(count<COUNT)
{
if(ver[pos]>ver[pos+1])++pos;
else
{
int nPos=pos;
while(ver[nPos+1]!='/0'&&ver[nPos]<=ver[nPos+1])
++nPos ;
while(ver[nPos]!='/0'){
ver[nPos]=ver[nPos+1];
++nPos;
}
--len;
}
++count;
}
for(int i=0;i<LEN-COUNT;++i)
{
ver[i]=ver[pos];
++pos;
}
ver[LEN-COUNT]='/0';
}
int main()
{
char ver[241];
int COUNT;
while (cin>>ver>>COUNT) {
Func(ver,COUNT);
if(strlen(ver)==0)cout<<"0"<<endl;
else cout<<ver<<endl;
}
return 0;
}
1944

被折叠的 条评论
为什么被折叠?



