rewrite Longest Palindrome