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

HELP!!! WA4!!
Posted by test_programs 5 Jun 2005 10:55
{Why?}
var S: string;
    ns: String;
    i: integer;
    j: integer;

function Palindrom(st: string): boolean;
var      i: integer;
         b: boolean;
begin
     b:=true;
     i:=1;
     while (i<=length(s) div 2) and b do
           begin
                if st[i]<>st[length(st)-i+1] then b:=false;
                inc(i);
           end;
     Palindrom:=b;
end;

function Revert(st: string): string;
var temp: string;
    i: integer;
begin
     temp:='';
     for i:=length(st) downto 1 do
         temp:=temp+st[i];
     revert:=temp;
end;

begin
     readln(s);
     i:=0;
     for j:=length(s)-2 downto 1 do
         if palindrom(Copy(s,j,length(s)-j+1)) then i:=j;
     if i=0 then
        begin
             ns:=Revert(Copy(s,1,length(s)-1));
             writeln(s+ns);
        end else
     if i=1 then writeln(s+Copy(s,2,length(s)-1)) else
        begin
             ns:=Revert(Copy(s,1,i-1));
             writeln(s+ns);
        end;
end.
Re: HELP!!! WA4!!
Posted by Виктор Крупко 6 Jun 2005 02:44
111
answer: 1111
do this massiv (read char)