|
|
back to boardHelp!!! WA!!! My code: ----------------------------------------------------------- program Task; {$APPTYPE CONSOLE} { Task #1354 } var s1: AnsiString; s2: AnsiString; function IsPalindrom(S: AnsiString): Boolean; var i: integer; begin IsPalindrom := True; for i := 1 to length(S) div 2 do if S[i] <> S[length(S) - i + 1] then begin IsPalindrom := False; break; end; end; function Revert(S: AnsiString): AnsiString; var i: integer; t: AnsiString; begin t := ''; for i := 1 to length(S) do t := t + S[length(s) - i + 1]; Revert := t; end; var i: integer; stop: boolean; begin Readln(s1); stop := false; i := 2; while not stop and (i <= length(s1)) do begin if IsPalindrom(Copy(s1,i,length(s1) - i + 1)) then begin s2 := Revert(Copy(s1,1,i - 1)); stop := true; end else inc(i); end; writeln(s1 + s2); end. ----------------------------------------------------------- I get Wrong Answer, but I think that my solution all right. WHY?? [Sorry for my bad English] P.S. AnsiString can consist 10000 symbols Edited by author 04.11.2005 11:40 |
|
|