def Main(): a=input() s=input() for x in s: if "a"<=x<="z": print(x,end="") else: print(a[int(x)],end="") print() Main()