题解 | 表示数字

表示数字

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

import sys

st = input()
f = 0
res = ''
for c in st:
    if not c.isdigit():
        if f:
            f = 0
            res+='*'
        res+=c
    elif c.isdigit():
        if not f:
            f=1
            res+='*'
        res+=c
if st[-1].isdigit():
    res+='*'  
print(res)

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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