A = list(input()) S = list(input()) ans = "" for i in range(len(S)): if S[i].isdigit() != True: ans += S[i] else: ans += A[int(S[i])] print(ans)