Program Palindrom; uses crt; type mas=array[1..10] of integer; var n,n0,kil,ch,ch1,kil1,i,k,hh,q,kk,s:integer; f,g:text; p:mas; procedure prog(p:mas; n:integer;var ch,kil,kk:integer;pp:mas ); begin pp[i]:=p[i]; ch:=1; kil:=5; i:=1; k:=0; for i:=1 to n do begin k:=k+1; if (p[i]+1)=(p[i+1]) then begin s:=i; hh:=0; end;end; q:=1; q:=q+1; kk:=(k-q); if hh=0 then begin kil:=0; for i:=1 to kk do begin kil:=kil+1; end; end; end; procedure Vvod(var ch,kil:integer); var p:mas; begin assign(f,'palidrom.dat'); reset(f); read(f,n); readln(f); for i:=1 to n do begin read(f,p[i]); end; prog(p,n,ch,kk,kil,p); end; procedure vuvid(ch,kil,kk:integer;pp:mas); begin assign(g,'palidrom.sol'); rewrite(g); write(g,kil); writeln(g); for i:=1 to kk do begin write(g,p[i]); end; end; Begin clrscr; vvod(ch,kil); vuvid(ch,kil,kk,p); close(f); close(g); end.