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