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