a = input() s = input() t = "" for c in s: if c.isdigit(): c = a[int(c)] t += c print(t)