题解 | #简单密码#
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
def trans(x):
if x == '1':
x = '1'
elif x in 'abc':
x = '2'
elif x in 'def':
x = '3'
elif x in 'ghi':
x = '4'
elif x in 'jkl':
x = '5'
elif x in 'mno':
x = '6'
elif x in 'pqrs':
x = '7'
elif x in 'tuv':
x = '8'
elif x in 'wxyz':
x = '9'
elif x == '0':
x = '0'
return x
ipt = input()
opt = ''
for i in ipt:
if i.islower():
opt += trans(i)
elif i.isupper():
if i != 'Z':
opt += chr(ord(i)+1).lower()
else:
i = 'a'
opt += i
else:
opt += trans(i)
print(opt)