View Code of Problem 50

#include<stdio.h>
#include<string.h> 
#define STR_LEN 80 
int main()
{
	int i,j=0,flag;
	char str1[STR_LEN + 1];
	char str2[STR_LEN + 1];
	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