#P4555. [国家集训队] 最长双回文串
[国家集训队] 最长双回文串
Description
A string that reads the same forward and backward is called a palindrome. For example, acbca is a palindrome, while abc is not: the forward order is abc, and the reverse is cba, which are not the same.
Given a string of length , find the longest double palindromic substring of , that is, can be divided into two parts (with ) and both and are palindromes.
Input Format
One line containing a string consisting of lowercase English letters.
Output Format
One line with a single integer, the length of the longest double palindromic substring.
baacaabbacabb
12
Hint
Sample Explanation
Starting from the second character, the string aacaabbacabb can be split into two parts aacaa and bbacabb, and both are palindromes.
Constraints
For of the testdata, .
2018.12.10, 2018.12.15: Thanks to @Ycrpro for providing two hack testdata sets.
Translated by ChatGPT 5
京公网安备 11011102002149号