View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50