题解 | #表示数字#

表示数字

https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6

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

int main() {
    string a, b;
    while (getline(cin, a)) {
        for (int i = 0;i < a.size();i++) {
            if (isdigit(a.at(i))) {
                cout << "*";
                while (i < a.size() && isdigit(a.at(i))) {
                    cout << a.at(i);
                    i++;
                }
                i--;
                cout << "*";
            } else {
                cout << a.at(i);
            }
        }
        cout << endl;
    }
}

全部评论

相关推荐

07-11 15:12
门头沟学院 Java
别人在上班,我就在工位上看看视频啥的,这正常吗?
程序员小白条:实习就是摸鱼,只是公司指标,把你进来了,可能那时候客户很多,但等你进来的时候,已经是淡季了,根本没多少需求,或者说根本不适合实习生去完成,因此你就每天干坐着就行,可能1,2个月都没需求
实习生的蛐蛐区
点赞 评论 收藏
分享
05-26 09:07
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-08 11:16
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务