题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
while 1: try: key = input() raw = input() newKey = '' alphabet = ''.join([chr(k) for k in range(ord('a'), ord('z') + 1)]) one = alphabet for k in key: if k not in newKey: newKey += k one = one.replace(k, '') pool = newKey + one res = '' for s in raw: index = 0 if s.isupper(): index = alphabet.find(s.lower()) res += pool[index].upper() else: index = alphabet.find(s) res += pool[index] print(res) except: break