For a given int sequence check number of double palindromes, where by double palindrome we mean sequence of two same palindromes without break between them. So for example:
in 1 0 1 1 0 1 we have 1 0 1 as a palindrome which appears 2 times without a break,
in 1 0 1 5 1 0 1 we have 1 0 1 but it's separated
(apart from the other palindromes in these sequences)
Problem example test data is:
3
12 0 1 1 0 0 1 1 0 0 1 1 0
12 1 0 1 0 1 0 1 0 1 0 1 0
6 3 3 3 3 3 3
with answers
8 0 9
Manacher is obvious for the begging, but I'm not sure what to do next. Any ideas appreciated. Complexity should be below n^2 I guess.
EDIT: int is here treated as single element of alphabet