题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
import sys KEY = input() chars = input() CHARs = [] list1 = [chr(i) for i in range(ord('a'), ord('z')+1)] head = [] dic = {} for i in range(len(KEY)): if KEY[i] not in head: head.append(KEY[i]) for i in range(len(list1)): if list1[i] not in head: head.append(list1[i]) for i, j in zip(list1, head): dic[i] =j for i in chars: CHARs.append(dic[i]) print("".join(CHARs))