You are given a string $S$ of length $N$.
There are $2N-1$ positions for the center of a palindromic substring of $S$: at the character or at the middle of two adjacent characters.
For the $i$-th of them ($0$-based), define $L_ i$ as the length of the maximum palindrome centered there (or $L_ i = 0$ if such a palindrome does not exist). Calculate the array $L_ 0,L_ 1,\ldots,L_ {2N-2}$.
$S$
$L_ 0$ $L_ 1$ ... $L_ {2N-2}$
abcbcba
1 0 1 0 3 0 7 0 3 0 1 0 1
mississippi
1 0 1 0 1 4 1 0 7 0 1 4 1 0 1 0 1 4 1 0 1
ababacaca
1 0 3 0 5 0 3 0 1 0 3 0 5 0 3 0 1
aaaaa
1 2 3 4 5 4 3 2 1
No. | Testdata Range | Score |
---|