a = input() s = input() t = "" for ss in s: if ss.islower(): t += ss else: t += a[int(ss)] print(t)