字母表新旧对照替换加密
from string import ascii_lowercase as strs
while True:
try:
key=input()
wd=input()
newstrs=""
temp=key+strs
# print(len(temp), temp)#测试,看长度
for i in temp:
if i not in newstrs:
newstrs+=i
# newstrs=list(set(temp))#不能用这种方法去重,集合去重是无序的
# print(len(newstrs),newstrs)#测试,看长度
res='' #保存结果
for i in wd:
if i.isupper():
res+=newstrs[strs.find(i)].upper()
else:
res+=newstrs[strs.find(i)]
print(res)
except:
break