题解 | #简单密码#
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
def nie(a):
dic = {"0":"0","1":"1","abc":"2","def":"3","ghi":"4","jkl":"5","mno":"6","pqrs":"7","tuv":"8","wxyz":"9"}
for key in dic:
if key.find(a) != -1:
return dic[key]
else:
continue
def da(b):
if ord(b)>=65 and ord(b)<90:
st = chr(ord(b)+32+1)
else:
st = 'a'
return st
if __name__ == '__main__':
#YUANzhi1987
st1 = input()
lst =[]
for i in st1:
if ord(i)>= 65 and ord(i) <= 90:
lst.append(da(i))
elif (ord(i)>= 97 and ord(i) <= 122) :
lst.append(nie(i))
else:
lst.append(i)
print(''.join(lst))