a = input() s = input() dic = {} for i,x in enumerate(a): dic[i] = x for x in s: try: print(dic[int(x)],end="") except: print(x,end="") print()