题解 | #字符串加解密#
字符串加解密
https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a
c = input() p = input() def change(i): if ord('A') <= ord(i) <= ord('Z'): return i.lower() if ord('a') <= ord(i) <= ord('z'): return i.upper() return i c1, p1 = '', '' mp = { 'z': 'A', 'Z': 'a', '9': '0'} for i in c: if i in mp: c1 += mp[i] else: i = change(i) c1 += chr(ord(i) + 1) print(c1) mp = { 'A': 'z', 'a': 'Z', '0': '9'} for i in p: if i in mp: p1 += mp[i] else: i = change(i) p1 += chr(ord(i) - 1) print(p1)