a = "21 52 34 35 13 44 21 { 35 34 31 54 12 24 45 43 _ 43 41 45 11 42 15 }" a = a.split() apl=[["a","b","c","d","e"], ["f","g","h","i,j","k"], ["l","m","n","o","p"], ["q","r","s","t","u"], ["v","w","x","y","z"]] for x in a: if x.isnumeric(): print(apl[int(x[0])-1][int(x[1])-1], end="") else: print(x, end="")