a=input() s=input() ans="" for i in s: if "0123456789".__contains__(i): ans+=a[int(i)] else: ans+=i print(ans)