题解 | #简单密码#

简单密码

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

while True:
    try:
        s=input()
        l=[]
        dic={"abc":'2',"def":'3',"ghi":'4',"jkl":'5',"mno":'6',"pqrs":'7',"tuv":'8',"wxyz":'9'}
        for i in s:
            if i.isdigit():
                l.append(i)
            elif i.isupper():
                if i == 'Z':
                    l.append('a')
                else:
                    l.append(chr(ord(i.lower())+1))
            else:
                for key in dic.keys():
                    if i in key:
                        l.append(dic.get(key))
        print("".join(l))
    except Exception as e:
#         print(e)
        break
全部评论

相关推荐

VirtualBool:都去逗他了?
点赞 评论 收藏
分享
Cherrycola01:0实习 0项目 约等于啥也没有啊 哥们儿这简历认真的吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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