A = input() S = input() for s in S: if s.isnumeric(): print(end=A[int(s)]) else: print(end=s) print()