Suffix passport control
The team from Uzlandia is visiting Venice this year, the host of the world programming semi-final.At the passport control in this city-country, a string s
of length N
is checked as follows:For each position i
in the range [0..N], the string formed by s[i..N] + rev(s) is examined to see if it is a palindrome. Here, s[i..N] represents the suffix of the string starting from position i
(inclusive), with positions numbered from zero. The suffix can be empty. rev(s) is the reverse of the string s, and "+" denotes the concatenation of two strings.Your task is to determine how many positions result in the aforementioned string being a palindrome.
Input
The input consists of a single line containing a string with a length of no more than 10^6
.
Output
Output a single integer, which is the solution to the problem.