#yuki-1335 A = input() def f(x): if x in '0123456789': return A[int(x)] else: return x print(''.join(map(f, input())))