View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main()
{
	char str1[80];
	char str2[80];
	gets(str1);
	int n=strlen(str1);
	int c=-1;
	int isNum=1;
	for(int i=0;i<n;i++) 
	{
		if(str1[i]<48||str1[i]>57)
		{
			if(isNum==1) c++;
			str2[c]='*';
			isNum=0;
		}
		else if(isNum==0)
		{
			c++;
			str2[c]=str1[i];
			isNum=1;
		}
		else
		{
			c++;
			str2[c]=str1[i];
		
		}
	}
	puts(str2);
	return 0;
}

Double click to view unformatted code.


Back to problem 50