type pe=^element; element=record dani: string; next: pe; end; var f, o: text; {вхідний і вихідний файл} head, tail: pe; {вказівники на початок і кінець черги} {Добавлення елементу до черги} procedure IsertQ (var head, tail: pe; s: string); var q: pe; BEGIN new(q); q^.dani:=s; q^.next:=nil; if head=nil then begin head:=q; tail:=q; end else begin tail^.next:=q; tail:=q; end; END; {Перегляд файлу} procedure ReadF (var f,o:text; var head, tail:pe); var i: byte; s, w: string; BEGIN while not(seekeof(f)) do begin readln(f,s); w:=''; for i:=1 to length(s) do begin if (s[i]<>' ') then w:=w+s[i]; if ((s[i] =' ') or (i=length(s))) and (0nil) do {поки черги не порожня} begin x:=head; write(o,x^.dani,' ');{виведення слова з черги} head:=head^.next; dispose(x); end; writeln(o); close(o); End; BEGIN head:=nil; tail:=nil; assign(f, 'input.txt'); reset(f); assign(o,'output.txt'); rewrite(o); ReadF(f,o,head,tail); WriteQ(o,head); END.