n = input()
n_T = n[::-1]
n_temp=[]
for i in n_T:
if i not in n_temp:
n_temp.append(i)
for i in n_temp:
print(i,end="")

n = input()
n_T = n[::-1]
n_temp=[]
for i in n_T:
if i not in n_temp:
n_temp.append(i)
for i in n_temp:
print(i,end="")