def main(): a = input() s = input() dic = {} others = {} for i in range(len(a)): others = {str(i):a[i]} dic.update(others) #print(dic) s2 = [] for j in s: if j in dic: s2.append(dic[j]) else: s2.append(j) print(*s2) #Aを辞書(key:アルファベット、value:0からの数字) #for文でsがvalueに含まれる場合、keyと変換 if __name__ == '__main__': main()