View Code of Problem 50

#include <stdio.h>
#include <string.h>
int main()
{
  int i,len,s = 0;
  int j = 0;//str2字符串的个数
  char str1[80],str2[80];
  scanf("%s",str1);
  len = strlen(str1);
  for(i=0;i<len;i++)
  {
  		if(str1[i]<='9'&&str1[i]>='0')
		  {	
    	 str2[j]=str1[i];
			   j++;
		    s=0;		
	  	}
	  	else
		  {
			   if(s==0)
		   	{
				   	str2[j]='*';
				    j++;
				    s=1;
			   }
		  }		
  }	
  printf("%s",str2);
  return 0;
}

Double click to view unformatted code.


Back to problem 50