题解 | #简单密码#

简单密码

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

s1 = input() s2 = [] index = 0 for i in s1 :
if i.isupper() and i != 'Z': index = ord(i) + 1 s2.append(chr(index).lower()) elif i.isdigit(): s2.append(i) elif i in 'Z': s2.append('a') elif i in 'abc': s2.append('2') elif i in 'def': s2.append('3')
elif i in 'ghi': s2.append('4')
elif i in 'jkl': s2.append('5') elif i in 'mno': s2.append('6')
elif i in 'pqrs': s2.append('7')
elif i in 'tuv': s2.append('8')
elif i in 'wxyz': s2.append('9')

print(''.join(s2))

全部评论

相关推荐

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