题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
alp = [chr(i) for i in range(ord("a"), ord("z") + 1)]
key = input()
code = input()
encrypt_list = []
for char in key:
if char not in encrypt_list:
encrypt_list.append(char)
for char in alp:
if char not in encrypt_list:
encrypt_list.append(char)
res = ""
for char in code:
res += encrypt_list[alp.index(char)]
print(res)
查看5道真题和解析
