a = input() s = list(input()) for i in range(len(s)): if s[i] in "0123456789": s[i] = a[int(s[i])] print(*s, sep = "")