string/longest_palindrome: simplify the implementation of longest_palindrome1
string/longest_palindrome: simplify the implementation of longest_palindrome4