s1=input()
s=list(s1)
list1=[]
for i in s:
if i not in list1:
list1.append(i)
length1=len(list1)
xunhuan=26-length1
alpha1='abcdefghijklmnopqrstuvwxyz'
alpha1=list(alpha1)
for zimu in range(26):
if alpha1[zimu] not in list1:
list1.append(alpha1[zimu])
# list1='trailbzescdfghjkmnopquvwxy'
# alpha1='abcdefghijklmnopqrstuvwxyz'
# list1=list(list1)
# alpha1=list(alpha1)
b1=input()#attackatdawn
b=list(b1)
b_result=[]
for number in b:
for alpha_number in range(26):
if number==alpha1[alpha_number]:
b_result.append(list1[alpha_number])
print("".join(b_result))
字符串转列表list()