题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
pre_key = input() encrypt = input() # key去重 key = [] for a in list(pre_key): if a not in key: key.append(a) alp = [chr(i) for i in range(97, 97 + 26)] for a in alp: if a not in key: key.append(a) out = [] for a in list(encrypt): out += key[alp.index(a)] print("".join(out))