View Code of Problem 50

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	getline(cin,s);
	int flag=1;
	for(int i=0;i<s.length();i++){
		if(s[i]>='0'&&s[i]<='9'){
			cout<<s[i];
			flag=1;
		}
		else{
			if(flag){
				cout<<'*';
				flag=0;
			}
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 50