ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1354. Palindrome. Again Palindrome

Palindome. Again Palindome
Posted by Buni_Real 9 Oct 2008 20:39
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