a = input() s = input() ans = "" for c in s: if ord(c) < ord("a"): ans += a[int(c)] else: ans += c print(ans)