View Code of Problem 50

#include <stdio.h>
#include <string.h>
int main()
{
	char ch[1000],compare[1000];
	gets(ch);
	int j=0,i=0;
	while(ch[i]!='\0')
	{
		if(ch[i]>='0' && ch[i]<='9')
		{
			compare[j] = ch[i];
			++j;
		}
		else 
		    ch[i] = '*';
        if(ch[i]=='*' &&((ch[i+1]>='0'&&ch[i+1]<='9') || ch[i+1]=='\0') )
        {
            compare[j] = ch[i];
			++j;			  	
		}		
	++i;
	}
		puts(compare);
		return 0;
 } 

Double click to view unformatted code.


Back to problem 50