View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50