A = input() S = input() ans = '' for s in S: if s.isdigit(): ans += A[int(s)] else: ans += s print(ans)