a = str(input()) s = str(input()) res = "" hm = {} for idx, c in enumerate(a): hm[idx] = c for i in s: if i.isdigit(): res += hm[int(i)] else: res += i print(res)