题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
# 大写小写都加上去了
i1 = input()
i2 = input()
lMap = [chr(ord("a")+i) for i in range(26) ]
cMap = [chr(ord("A")+i) for i in range(26) ]
lList = []
cList = []
for i in i1:
if i in lMap:
lList.append(i)
lMap.remove(i)
elif i in cMap:
cMap.remove(i)
cList.append(i)
lList += lMap
cList += cMap
outChar = ""
for i in i2:
if i in lList:
outChar += lList[ord(i) - ord("a")]
elif i in cList:
outChar += cList[ord(i) - ord("A")]
else:
outChar += i
print(outChar)