# include<stdio.h>
# include<stdlib.h>
# include<string.h>
int main()
{
int l, n, i, k;
char a[101];
while(scanf("%s %d", a, &n) != EOF)
{
for(i = 0; i < n; i++)
{
l = strlen(a);
k = 0;
while(k < l && a[k] <= a[k + 1])
{
k++;
}
while(k < l)
{
a[k] = a[k + 1];
k++;
}
}
l = strlen(a);
k = 0;
while(k < l && a[k] == '0')
{
k++;
}
if(k == l)
{
printf("%d\n", 0);
}
else
{
while(k < l)
{
printf("%c", a[k]);
k++;
}
}
printf("\n");
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
int n, k, i, j;
cin>>a>>n;
int len = a.size();
for(i = 0; i < n; i++)
{
for(j = 0; j < len - 1; j++)
{
if(a[j] > a[j + 1])
{
for(k = j; k < len - 1; k++)
a[k] = a[k + 1];
break;
}
}
len--;
}
int num = 0;
while(num <= len - 1 && a[num] == '0')
num++;
if(num == len)
cout<<"0"<<endl;
else
for(int i = num; i <= len - 1; i++)
cout<<a[i];
return 0;
}
|