a = input() b = input() c = "" for i in b: if i in "0123456789": c += a[int(i)] else: c += i print(c)