题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
string = input().strip() def func(string): z_list = "abcdefghijklmnopqrstuvwxyz" Z_list = z_list.upper()[:25] num_list = "0123456789" z = str() for s in string: if s in num_list: s = s elif s in z_list[0:3]: s = "2" elif s in z_list[3:6]: s = "3" elif s in z_list[6:9]: s = "4" elif s in z_list[9:12]: s = "5" elif s in z_list[12:15]: s = "6" elif s in z_list[15:19]: s = "7" elif s in z_list[19:22]: s = "8" elif s in z_list[22:26]: s = "9" elif s in Z_list: for j in range(len(Z_list)): if s == Z_list[j]: s = z_list[j+1] elif s == "Z": s = "a" z = z + s return z print(func(string))#HJ21#