#include <iostream> #include <string> using namespace std; int main() { string s1, s2; int i; getline(cin, s1); if (s1[0] >= '0'&&s1[0] <= '9') { s2 += s1[0]; } else { s2 += '*'; } for (i = 1; i < s1.length(); i++) { if (s1[i] >= '0'&&s1[i] <= '9') { s2 += s1[i]; } else { if (s1[i - 1] >= '0'&&s1[i - 1] <= '9') { s2 += '*'; } } } cout << s2 << endl; return 0; } |
Double click to view unformatted code.