题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
#参考:https://blog.nowcoder.net/n/0e43f0734f7846f4bbda13f560c8d71b?f=comment
while True:
try:
inputstring = input()
A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
B="22233344455566677778889999bcdefghijklmnopqrstuvwxyza0123456789"
newlist=[]
for char in inputstring:
index = A.find(char)
if index == -1:
newlist.append(char)
else:
newlist.append(B[index])
for element in newlist:
print(element,end='')
except:
break

查看1道真题和解析