A=input() S=input() for i in S: if i in "0987654321": print(A[int(i)],end="") else: print(i,end="") print()