View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main()
{	
	char str1[1001];
	char str2[1001];
	int j=0;//j别忘了附值 
	int n,m;
	gets(str1);
	n=strlen(str1);
	for(int i=0;i<n;i++)
	{
		if(str1[i]>='0'&&str1[i]<='9')
		{
			str2[j]=str1[i];
			j++;			
		}
		else if(str2[j-1]!='*')
		{	str2[j]='*';
			j++;
		}	
	}
	puts(str2);
	return 0;	
}

Double click to view unformatted code.


Back to problem 50