string: simplify the implementation of long_palindrome1