var s1,s2:string;
p1,p2:integer;
begin
& readln(s1);
& readln(s2);
& s1:=' '+s1+' ';
& s2:=' '+s2+' ';
& p2:=pos(' ',s1);
& p1:=0;
& while (p2<length(s1)) do
begin
if odd(length(copy(s1,p1+1,p2-p1-1)))
& then
& begin
s2:=s2+copy(s1,p1+1,p2-p1-1)+' ';
delete(s1,p1+1,p2-p1-1);
p2:=p1;
& end
else
& begin
p1:=p2;
p2:=pos(' ',copy(s1,p1+1,length(s1)-p2+1))+p1;
& end;
end;
& p2:=pos(' ',s2);
& p1:=0;
& while (p2<length(s2)) do
begin
if (not odd(length(copy(s2,p1+1,p2-p1-1))))and(length(copy(s2,p1+1,p2-p1-1))>0)
& then
begin
s1:=s1+copy(s2,p1+1,p2-p1-1)+' ';
delete(s2,p1+1,p2-p1-1);
p2:=p1;
end
& else
begin
p1:=p2;
p2:=pos(' ',copy(s2,p1+1,length(s2)-p2+1))+p1;
end;
end;
writeln(s1);
writeln(s2);
end.
Comments
You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!
thanks a lot this is so helpful of you
Leave a comment