View Code of Problem 50

#include <stdio.h>
#include <string.h>
int main()
{
	char a[81];
	char str2[81];
	int q;
	gets(a);
	int i;
	q = 0; 
	int n;
	n = strlen(a);
	for(i = 0;i<n;i++)
	{
		if(a[i]>='0'&&a[i]<='9')
		{
		str2[q] = a[i];
		q = q + 1;		
		}
		else if(str2[q-1]!='*')
		{
			str2[q] = '*';
			q = q + 1;
		}
		

	}
	str2[q] = '\0';
	puts(str2);
	
	return 0;
 } 

Double click to view unformatted code.


Back to problem 50