View Code of Problem 50

#include <stdio.h>
#include <string.h>
#include <math.h>
//int gys(int a,int b){
//	int t;
//	if(a>b){
//		t=a;
//		a=b;
//		b=t;
//	}
//	while(b!=0){
//		t=a%b;
//		a=b;
//		b=t;
//		
//	}
//	return a;
//}

int main(){
	char str1[80];
	char str2[80];
	int k=0;
	gets(str1);
	int i;
	for(i=0;i<strlen(str1);i++){
		if((str1[i]<'0'||str1[i]>'9')&&(str1[i+1]>='0'&&str1[i+1]<='9'))
			str2[k++]='*';
		else if(str1[i]>='0'&&str1[i]<='9')
			str2[k++]=str1[i];
		else if(i==strlen(str1)-1&&(str1[strlen(str1)-1]<'0'||str1[strlen(str1)-1]>'9'))
			str2[k++]='*';
	}
	str2[k]='\0';
	puts(str2); 
}

Double click to view unformatted code.


Back to problem 50