题解 | #简单密码#

简单密码

https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac

line = str(input())
###暴力解决
for item in line:
    item = str(item)
    if item in ('a','b','c'):
        print(2,end='')
    elif item in ('d','e','f'):
        print(3,end='')
    elif item in ('g','h','i'):
        print(4,end='')
    elif item in ('j','k','l'):
        print(5,end='')
    elif item in ('m','n','o'):
        print(6,end='')
    elif item in ('p','q','r','s'):
        print(7,end='')
    elif item in ('t','u','v'):
        print(8,end='')
    elif item in ('w','x','y','z'):
        print(9,end='')

    elif ord('A')<=ord(item)<=ord('Z') and item!='Z':
        print(chr(ord(item.lower())+1),end='')

    elif item=='Z':
        print('a',end='')

    else: print(item,end='')

全部评论

相关推荐

04-11 15:34
已编辑
华中科技大学 网络安全
疯犬丨哈士奇:意思就是:我们还有其他更优秀的人在等回复,如果他们不要这个机会就会来找你
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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