#include<bits/stdc++.h> using namespace std; int main(){ string s; //cin>>s; getline(cin,s); int l = s.size(); int f = 0; for (int i = 0; i < l; i++) { if (s[i] >= '0'&&s[i] <= '9') { printf("%c", s[i]); f = 0; } else { if (f == 0) { printf("*"); f = 1; } } } return 0; } |
Double click to view unformatted code.