Var a, b: array[1..110000] of integer; i, n, j, cnt: integer; begin
Readln(n); for i := 1 to n do Read(a[i]); Write(a[1], ' '); for i := 2 to n - 1 do Begin if a[i] > 0 then Write(a[i], ' '); i if (a[i] < 0) and (a[i - 1] > 0) and (cnt = 0) then for j := i to n do begin if (j = n) and (a[j] < 0) then begin cnt:= 0; break; end; if a[j] > 0 then break else cnt:= cnt + 1; end; if cnt = 0 then Write(a[i], ' '); if cnt > 0 then cnt := cnt - 1; end; Write(a[n]); end.
a, b: array[1..110000] of integer;
i, n, j, cnt: integer;
begin
Readln(n);
for i := 1 to n do
Read(a[i]);
Write(a[1], ' ');
for i := 2 to n - 1 do
Begin
if a[i] > 0 then Write(a[i], ' ');
i if (a[i] < 0) and (a[i - 1] > 0) and (cnt = 0) then for j := i to n do begin if (j = n) and (a[j] < 0) then
begin
cnt:= 0;
break;
end;
if a[j] > 0 then
break
else
cnt:= cnt + 1;
end;
if cnt = 0 then Write(a[i], ' '); if cnt > 0 then cnt := cnt - 1;
end;
Write(a[n]); end.