题解 | #表示数字#
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
#include <bits/stdc++.h>
using namespace std;
int main(){
string s = "";
while(cin >> s){
string res = "";
int i = 0; //
while(i < s.size()){
if(isdigit(s[i])){
res += "*";
int right = i;
while(right < s.size() && isdigit(s[right])){
res += s[right];
right++;
i++;
}
res += "*";
}
else{
res += s[i];
i++;
}
}
cout << res << endl;
}
return 0;
}
华为题库题解 文章被收录于专栏
牛客华为题库的题解