View Code of Problem 50

#include "stdio.h"
#include "string.h"
#define N 80

void main()
{
  char x[N],y[N];
  int s,i,t;
  gets(x);
  s=strlen(x);
  t=0;
  for(i=0;i<s;i++)
  {
    if(x[i]>='0'&&x[i]<='9')
	{
	   y[t]=x[i];
	   t++;
	}
	else
	{
	   if(i==(s-1))
	   {
	      y[t]='*';
		  t++;
		  break;
	   }
	   else
	   {
	     if(x[i+1]>='0'&&x[i+1]<='9')
		 {
		    y[t]='*';
			t++;
		 }
	   }
	}
  }
  y[t]='\0';
  puts(y);
}

Double click to view unformatted code.


Back to problem 50