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