View Code of Problem 609

#include <stdio.h>
#include <string.h>
int main(){
  char a[1000];
  int n,i;
  while(scanf("%s%d",s,&n)!=EOF){
    int len=strlen(a);
    while(n--){
      i=0;
      while(a[i]<=a[i+1]&&i<len){
        i++;
      }
      for(j=i;j<len-1;j++){
        a[j]=a[j+1];
      }
      len--;
    }
    int k=0;
    while(a[k]=='0'){k++;}
    if(k<len){
      for(i=k;i<len;i++){
        printf("%c",a[i]);
      }
      printf("\n");
    }else  printf("0\n");
    
  }
}
/*
Main.c: In function 'main':
Main.c:6:22: error: 's' undeclared (first use in this function)
   while(scanf("%s%d",s,&n)!=EOF){
                      ^
Main.c:6:22: note: each undeclared identifier is reported only once for each function it appears in
Main.c:13:11: error: 'j' undeclared (first use in this function)
       for(j=i;j<len-1;j++){
           ^
*/

Double click to view unformatted code.


Back to problem 609