View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50