View Code of Problem 50

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int a[20];
int main(){
	char str1[100];
	int len;
	int flag;
	while(gets(str1)){
		len=strlen(str1);
		flag=0;
		for(int i=0;i<len;i++){
			if(str1[i]>='0'&&str1[i]<='9'){
				if(flag == 1){
					printf("*");
					flag = 0;
				}
				printf("%c",str1[i]);
			}
			else{
				flag = 1;
			}
		}
		if(flag==1)
		printf("*");
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 50