View Code of Problem 50

#include<bits/stdc++.h>
using namespace std;

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

	return 0;
}

Double click to view unformatted code.


Back to problem 50