View Code of Problem 50

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



int main() {

	string s;
	getline(cin,s);
	int flag=0;
	for(int i=0;i<s.length();i++){
		if(s[i]>='0'&&s[i]<='9'){
			if(flag==1){
				flag=0;
			}
			cout<<s[i];
		}else{
			if(flag==0){
				cout<<"*";
				flag=1;
			}
		}
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 50