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