View Code of Problem 50

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

Double click to view unformatted code.


Back to problem 50