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

Its very very easy!!!
Posted by RASTA 19 Mar 2009 13:33
my idea for solution
  k := 2;
  n := length(s);
  s1 := s[1];
  while true do begin
    i := 0;
    while (n - i >= k + i) and (s[k + i] = s[n - i]) do inc(i);
    if n - i <= k + i
    then begin
      write(s + s1);
      halt;
    end;
    s1 := s[k] + s1;
    inc(k);
  end;