lst=list(input()) llst=list(input()) for i in range(len(llst)): for j in range(10): if llst[i]==str(j):llst[i]=lst[j] print("".join(llst))