|
|
вернуться в форумPalindome. Again Palindome WA#4 program Palindome. Again Palindome; var a:array [1..20010] of char; i,j,k,n,w:integer; r:char; s:string; f:boolean; g:text; t:integer; procedure solve; label 1; var e:integer; begin f:=false; t:=0; for k:=1 to n+i do if (a[k]<>a[n+i-k+1]) then goto 1; f:=true; 1: end; {IMPORTANT PART} Begin assign(g,'input.txt'); reset(g); while not eof(g) do begin readln(g,s); n:=0; for i:=1 to length(s) do begin n:=n+1; a[n]:=s[i]; end; i:=0; repeat solve; if not(f) then begin i:=i+1; for j:=n+i downto n+1 do begin a[j]:=a[j-1]; end; a[n+1]:=a[i]; solve; end; until f; end; close(g); for j:=1 to n+i do write(a[j]); readln;readln; end. THANKS ALL RIGHT |
|
|