s = input() t = input() a = [] for c in t: if c.isdigit(): a.append(s[int(c)]) else: a.append(c) print(*a, sep = "")