A = input() S = input() print("".join([A[int(c)] if c.isdigit() else c for c in S]))