Longest Palindrome by test

def longest_palindrome s
 s.size.downto(0) do |i|
  0.upto(s.size-i) do |j|
   x = s[j,i]
   return x if x.reverse == x
  end
 end
end
puts longest_palindrome $_ while gets

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

download

return top