solve longest_palindrome