View Code of Problem 50

#include <stdio.h>

#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
//#include <conio.h>
#include <math.h>
#include <string.h>

int main()
{
	char s[101]="";
	char f=0;
	long a,b,c;
	double x,y;
	double z;

	/*if(freopen("input.txt", "rt", stdin)==0)
	{
	}*/

	/*if(freopen("output.txt", "wt", stdout)==0)
	{
		errorMsg("Opened file '%s' is error!\n","output.txt");
	}*/


	
	while (gets(s)!=NULL)
	{
		a = strlen(s);		
		c=0;
		f=0;
		for (b=0;b<a;b++) 
		{
			if(isdigit(s[b]))
			{
				s[c++]=s[b];
				f=0;
			}
			else 
			{
				if(f==0)
				{
					f=1;
					s[c++]='*';
				}				
			}
		}
		s[c]='\0';

		printf("%s\n",s);
	}	
	
    return 0;
}

Double click to view unformatted code.


Back to problem 50