View Code of Problem 50

#include<stdio.h>
#include<string.h>
#define N 80
int main()
{
	char str1[N],str2[80];
	gets(str1);

	int l=0,i=0,j=0;

	l = strlen(str1);

	for(i = 0; i < l; i++)
	{
		if(str1[i] >= '0' && str1[i] <= '9')
		{
			str2[j++] = str1[i];
		}

		else
		{
			i++;
			
			if(str1[i] < '0' || str1[i] > '9')
			{
				while(str1[i] < '0' || str1[i] > '9')
				{
					i++;
				}

				str2[j++] = '*';
				i--;
			}

			else
			{
				i--;
				str2[j++] = str1[i];
			}
		}
	}
	str2[j] = NULL;

	puts(str2);

	return 0;
}

Double click to view unformatted code.


Back to problem 50