View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main(){
	char str[81],strstr[81];
  	gets(str);
  	int len=strlen(str);
  	int i,j=0;
  	if(str[0]>='0'&&str[0]<='9')
          strstr[j++]=str[0];
  	else
          strstr[j++]='*';
 	 for(i=1;i<len;i++){
  			if(str[i]>='0'&&str[i]<='9')
              strstr[j++]=str[i];
            else{
              if(strstr[j-1]!='*')
                 strstr[j++]='*';
           }
			}
   for(i=0;i<j;i++)
   {
	printf("%c",strstr[i]);
   }
   printf("\n");
  
  
return 0;
}

Double click to view unformatted code.


Back to problem 50