题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
import sys key = sys.stdin.readline().strip() s = sys.stdin.readline().strip() newList = [] for letter in key: if letter not in newList: newList.append(letter) for i in range(26): for letter in newList: if chr(ord('a')+i) not in newList: newList.append(chr(ord('a')+i)) ans = '' for letter in s: idx = ord(letter) - ord('a') ans += newList[idx] print(ans)#题库#