题解 | #简单密码#
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
while True:
try:
##循环右移
def shift_left(s):
shift = 1
if s >= 'a' and s <= 'z':
s = ord(s)
s = ((s+shift)-97)%26+97
s = chr(s)
return s
s = input()
res = []
for i in s:
if i.isdigit():
res.append(i)
elif i.isupper() :
res.append(shift_left(i.lower()))
else:
if i in 'abc':
res.append('2')
elif i in 'def':
res.append('3')
elif i in 'ghi':
res.append('4')
elif i in 'jkl':
res.append('5')
elif i in 'mno':
res.append('6')
elif i in 'pqrs':
res.append('7')
elif i in 'tuv':
res.append('8')
else:
res.append('9')
print(''.join(res))
except:
break
文远知行公司福利 583人发布