A = input() S = input() ans = '' for i in range(len(S)): if str.isdecimal(S[i]): ans += A[int(S[i])] else: ans += S[i] print(ans)