a=input() s=input() ans='' for i in s: ans+=a[int(i)] if i.isnumeric() else i print(ans)