题解 | #字符串加解密# (固定对应替换关系的常规解法)
字符串加解密
https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a
#看了半天原来是cyphertext里少写了A和a导致一直有bug。。。。无语了 plaintext = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' cyphertext = 'BCDEFGHIJKLMNOPQRSTUVWXYZAbcdefghijklmnopqrstuvwxyza1234567890' while True: try: input_plaint = input() input_cypher = input() pt = list(plaintext) ct = list(cyphertext) out1 = '' out2 = '' index = 0 for element in input_plaint: index = plaintext.find(element) out1 = out1 + ct[index] index = 0 for element in input_cypher: index = cyphertext.find(element) out2 = out2 + pt[index] print(out1) print(out2) except: break