题解 | #截断电话号码#

截断电话号码

https://www.nowcoder.com/practice/078d1abcb55648f687a78d87e4b3cb69

strs = input()
tiqu = list()
for i in strs:
    if(i == '0' or i == '1' or i == '2' or i == '3' or i == '4' or i == '5' or i == '6' or i == '7' or i == '8' or i == '9' or i == '-'):
        tiqu.append(i)
    elif (i == '#'):
        break
    else:
        continue

for i in tiqu:
    print(i,end='')

全部评论

相关推荐

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