View Code of Problem 50

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	char str1[1000],str2[1000];
	int i,j,flag=0;
	gets(str1);
	for(i=0,j=0;i<strlen(str1);i++){
		if(str1[i]>='0' && str1[i]<='9'){
			str2[j++]=str1[i];
			flag=0;
		}
		else if(flag==0){
			str2[j++]='*';
			flag=1;
		}
		
	}
	for(i=0;i<j;i++){
		printf("%c",str2[i]);
	}
	
}

Double click to view unformatted code.


Back to problem 50