a = input() s = input() def f(c): if c.isdigit(): return a[int(c)] return c ans = [f(c) for c in s] print(ans)