题解 | #字符串加解密#
字符串加解密
https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a
s1 = input() s2 = input() res1 = [] res2 = [] for i in s1: if i.isupper() and i != 'Z': #i = i.lower() res1.append(chr(ord(i.lower())+1)) if i.islower() and i != 'z': #i = i.lower() res1.append(chr(ord(i.upper())+1)) if i == 'Z': #i = i.lower() res1.append("a") if i == 'z': #i = i.lower() res1.append("A") if i.isdigit() and i != str(9): res1.append(str(int(i)+1)) if i == str(9): res1.append("0") for i in s2: if i.isupper() and i != 'A': #i = i.lower() res2.append(chr(ord(i.lower())-1)) if i.islower() and i != 'a': #i = i.lower() res2.append(chr(ord(i.upper())-1)) if i == 'a': #i = i.lower() res2.append("Z") if i == 'A': #i = i.lower() res2.append("z") if i.isdigit() and i != str(0): res2.append(str(int(i)-1)) if i == str(0): res2.append("9") print("".join(res1)) print("".join(res2))