const n=100; var a:array[1..n] of integer; i,j:integer; f1, f2:text; begin Assign(f1,'input.txt'); reset(f1); Assign(f2,'output.txt'); rewrite(f2); i:=0; while not eof(f1) do begin inc(i); read(f1,a[i]); write(a[i],' '); if a[i]<>0 then write(f2,' ',a[i]) end; writeln; close(f2); reset(f2); for j:=1 to i do a[i]:=0; i:=0; while not eof(f2) do begin inc(i); read(f2,a[i]); write(a[i],' '); end; writeln; close(f1);close(f2); end. פאיכ input.txt: -5 2 -3 1 2 3 -1 1 4 -1 2 1 2 -1 -4 4 -2 -1 4 -2 פאיכ output.txt: -5 2 -3 1 2 3 -1 1 4 -1 2 1 2 -1 -4 4 -2 -1 4 -2