A=input() S=input() for s in S: if s.isnumeric(): print(A[int(s)],end='') else: print(s,end='') print()