program z5;
var i,k,x:integer; t1,t2:text; s1,s2,s3:string;
begin
k:=1;
assign(t1,'input.txt');
assign(t2,'output.txt');
reset(t1); rewrite(t2);
readln(t1,s1); readln(t1,s2);
if (s1='{}') and (s2='{}') then s3:='{}';
if (s1='{{}}') and (s2='{{}}') then s3:='{{},{{}}}';
if ((s1='{}') and (s2='{{}}')) or ((s2='{}') and (s1='{{}}')) then s3:='{{}}';
if ((s1='{{},{{}}}') and (s2='{{}}')) or ((s2='{{},{{}}}') and (s1='{{}}')) then s3:='{{},{{}},{{},{{}}}}';
if ((s1='{{},{{}}}') and (s2='{}')) or ((s2='{{},{{}}}') and (s1='{}')) then s3:='{{},{{}}}';
if ((s1='{{},{{}},{{},{{}}}}') and (s2='{}')) or ((s2='{{},{{}},{{},{{}}}}') and (s1='{}')) then s3:='{{},{{}},{{},{{}}}}';
write(t2,s3);
close(t1); close(t2);
end.
