题解 | #字符串加密#
字符串加密
http://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
'''nihao ABCDEFGHIJKLMNOPQRSTUVWXYZ NIHAOBCDEFGJKLMPQRSTUVWXYZ ''' while True: try: source = input() example = input() L1 = 'abcdefghijklmnopqrstuvwxyz' L2 = [] for i in range(len(source)): #去重 if source[i] not in L2: L2.append(source[i]) else: continue L3 = L2 + [sentence for sentence in L1 if not any(word in sentence for word in L2)] #去除L1中包含的L2的字符,拼接生成新的列表 for i in example: print(L3[L1.index(i)], end = '') except: break