题解 | #简单密码#
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
python3简单粗暴
def func():
s = input()
res = []
tab = [['0'],['1'],['a','b','c'],['d','e','f'],['g','h','i'],['j','k','l'],['m','n','o'],['p','q','r','s'],['t','u','v'],['w','x','y','z']]
for i in s:
if i in tab[2]:
res.append('2')
elif i in tab[3]:
res.append('3')
elif i in tab[4]:
res.append('4')
elif i in tab[5]:
res.append('5')
elif i in tab[6]:
res.append('6')
elif i in tab[7]:
res.append('7')
elif i in tab[8]:
res.append('8')
elif i in tab[9]:
res.append('9')
elif ord('A') <= ord(i) < ord('Z'):
a = chr(ord(i)+1).lower()
res.append(a)
elif i == 'Z':
res.append('a')
else:
res.append(i)
for i in res:
print(i,end=(''))
func()