s=input() t=input() ans="" for i in t: if i in ["0","1","2","3","4","5","6","7","8","9"]: ans+=s[int(i)] else: ans+=i print(ans)