题解 | #表示数字#

表示数字

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

while True:
    try:
        s = input()
        s += ' '
        k = False
        opt = ''
        for i in range(len(s)):
            if not s[i].isnumeric() and k == False:
                opt += s[i]
            if s[i].isnumeric() and k == False:
                k = True
                opt += '*'
            if s[i].isnumeric() and k == True:
                opt += s[i]
            if not s[i].isnumeric() and k == True:
                k = False
                opt += '*'
                opt += s[i]
        print(opt)
    except:
        break
全部评论

相关推荐

2 收藏 评论
分享
牛客网
牛客企业服务