import string A = input() S = input() T = "" for s in S: if s in string.digits: T += A[int(s)] else: T += s print(T)