View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50