Super palindromes#570

Super palindromes

3 seconds
128 megabytes
Hard (≈1650)

The palindrome is a string with a length greater than one character that reads the same both from right to left and left to right. A superpalindrome is a string that can be represented as the concatenation of one or more palindromes.

You are given a string . Find the number of substrings in that are superpalindromes.

Input

The string that consists of a sequence of lowercase Latin letters with a length from to , without spaces.

Output

Print a single integer — the number of substrings of the string that are superpalindromes.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading