Longest palindrome implementation