Longest Palindrome by ditto

while 1:
 s=raw_input();l=v=len(s)
 while l:
  for o in range(v-l+1):
   p=s[o:o+l]
   if p[::-1]==p:print p;l=1;break
  l-=1

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top