题解 | #表示数字#

表示数字

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

while True:

try:
    str_input = input()
    result = ''
    for i in range(len(str_input)):
        if not str_input[i].isdecimal():
            result += str_input[i]
            if i != len(str_input) - 1 and str_input[i+1].isdecimal():
                result += '*'
        else:
            result += str_input[i]
            if i != len(str_input) - 1 and not str_input[i+1].isdecimal():
                result += '*'
            elif i == len(str_input) - 1:
                result += '*'
            if i == 0:
                result = '*' + result

                
    print(result)
    
except:
    break
全部评论

相关推荐

评论
3
收藏
分享

创作者周榜

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