a = input() s = input() ans = '' for c in s: if '0' <= c <= '9': ans += a[int(c)] else: ans += c print(ans)