View Code of Problem 50

#include<stdio.h>
#include<string.h>
void main()
{
	char str1[100],str2[100];
	int i,j=0,m=0;
	gets(str1);
	for(i=0;i<strlen(str1);i++)
	{
		if(str1[i]>='0'&&str1[i]<='9')
		{
			str2[j]=str1[i];
				m=0;
				j++;
		}
	else
		{
			m++;
			if(m==1)
			{
				str2[j]='*';//字符只能用单引号
				j++;
			}
		}
	}
	str2[j]='\0';
	puts(str2);
}

Double click to view unformatted code.


Back to problem 50