题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
思路:构造对应表取值
key = input() s = input() res = '' alp1 = 'abcdefghijklmnopqrstuvwxyz' # 构造alp2,与alp1对相对应 alp2 = '' for i in key + alp1: if i not in alp2: alp2 += i # 对应取值 for i in s: res += alp2[alp1.find(i)] print(res)