简单密码(Python)
简单密码
http://www.nowcoder.com/questionTerminal/7960b5038a2142a18e27e4c733855dac
强迫症式的字典 :)
dic = {'a':2, 'd':3, 'g':4, 'j':5, 'm':6, 'p':7, 't':8, 'w':9, 'b':2, 'e':3, 'h':4, 'k':5, 'n':6, 'q':7, 'u':8, 'x':9, 'c':2, 'f':3, 'i':4, 'l':5, 'o':6, 'r':7, 'v':8, 'y':9, 's':7, 'z':9} while True: try: s, res = input(), '' for i in s: if i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': res += 'a' if i == 'Z' else chr(ord(i) + 33) elif i in '0123456789': res += i else: res += str(dic.get(i)) print(res) except: break