s=input() t=input() ans="" for x in t: if "0"<=x<="9": ans+=s[int(x)] else: ans+=x print(ans)