# #解法1,直接if else # import sys # def convert(c): # if c.isupper(): # if c == 'Z': # return "a" # else: # return chr(ord(c.lower()) + 1) # elif c in "abc": # return '2' # elif c in "def": # return '3' # elif c in "ghi": # return '4' # elif c in "jkl": # return '5' # elif c in "mno": # return '6' # elif c in "pqrs": # return '7' # elif c in "tuv": # return '8' # elif c in "wxyz": # return '9' # else: # return c # while True: # try: # p = input() # result = "" # for i in range(len(p)): # result += convert(p[i]) # print(result) # except: # #print(sys.exc_info()) # break #解法2,搞一个字典 dic = {"abc":'2', "def":'3', "ghi":'4',"jkl":'5',"mno":"6","pqrs":'7',"tuv":'8',"wxyz":'9'} def convert(c): if c.isupper(): if c == 'Z': return "a" else: return chr(ord(c.lower()) + 1) if c.islower(): for key in dic: if c in key: return dic[key] else: return c while True: try: p = input() result = "" for i in range(len(p)): result += convert(p[i]) print(result) except: #print(sys.exc_info()) break