View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50