A = input() S = input() ans = "" for i in S: if '0' <= i <= '9': ans += A[int(i)] else: ans += i print(ans)