var
s1,s2:string;
procedure solve(s1,s2:string);
var
k:integer;
begin
if length(s2)=1 then write(s2)
else begin
k:=pos(s2[length(s2)],s1);
write(s1[k]);
if k>1 then solve(copy(s1,1,k-1),copy(s2,1,k-1));
if k<length(s1)
then
solve(copy(s1,k+1,length(s1)-k),copy(s2,k,length(s2)-k));
end;
end;
begin
assign(input,'nlr.in');
assign(output,'nlr.out');
reset(input);
rewrite(output);
readln(s1);
readln(s2);
solve(s1,s2);
close(input);
close(output);
end.