Program Palindrom; Var a,y : array[0..101] of longint; p,m,d,b,h,o,w : longint; fi,fo : text; Procedure Inp; Var i,x : longint; Begin Assign(fi,'palindro.dat'); Reset(fi); Readln(fi,p); i:=1; x:=p+1; While i0 do begin Write(fo,y[p]); p:=p-1; Write(fo,' '); end; Close(fo); End;{INP} Function Sim (Var t : array of longint; f : longint) : longint; Var s,j : longint; u : real; Begin s:=3; j:=1; u:=f/2; While (s>1) and (f>u) do begin if a[j] <> a[f] then begin s:=1; end; f:=f-1; j:=j+1; end; Sim:=s; End;{SIM} Begin Inp; m:=Sim(a,p); b:=1; d:=p; h:=p; o:=1; w:=1; While m<>3 do begin While o<>0 do begin a[d+w]:=a[o]; w:=w+1; o:=o-1; end; y[b]:=a[b]; b:=b+1; h:=h+1; m:=Sim(a,h); o:=b; w:=1; end; p:=b-1; Out; End.