View Code of Problem 50

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	char s1[100], s2[100];
	int flag = 0, cnt = 0;
	gets(s1);
	for(int i = 0;i < strlen(s1);i++){
		if(s1[i]>='0'&&s1[i]<='9'){
			s2[cnt++] = s1[i];
			flag = 0;
		}else if(flag==0){
			s2[cnt++] = '*';
			flag = 1;
		}
	}
	printf("%s\n", s2);

	return 0;
}

Double click to view unformatted code.


Back to problem 50