#F0789. Palindrome Degree
Palindrome Degree
题目描述
String s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length
are (k-1)-palindromes. By definition, any string (even empty) is 0-palindrome.
Let's call the palindrome degree of string s such a maximum number k, for which s is k-palindrome. For example, "abaaba" has degree equals to 3.
You are given a string. Your task is to find the sum of the palindrome degrees of all its prefixes.
The first line of the input data contains a non-empty string, consisting of Latin letters and digits. The length of the string does not exceed 5·106. The string is case-sensitive.
Output the only number − the sum of the polindrome degrees of all the string's prefixes.
a2A
1
abacaba
6
题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 217 题。保留原作者与原赛事署名。