#P4840. P哥旋转
P哥旋转
Description
P-bro has learned a new method for string processing: rotation.
A “rotation” is an operation like this: remove the last character of the original string, then add it to the very front, obtaining a new string.
P-bro can perform the “rotation” operation infinitely many times, in order to make the number of essentially different palindromic substrings in the resulting new string as large as possible.
Two palindromic strings are essentially different if and only if their lengths are different, or there exists at least one position where the characters are different.
Now P-bro has obtained a string . Please help P-bro achieve his goal through “rotation” operations (i.e., the bolded part above), and output the number of different palindromic substrings in the new string.
Input Format
The input consists of one line, which is the string , guaranteed to contain only lowercase English letters.
Output Format
Output one integer, representing the answer.
ioimoio
7
fcfcfcfcfczxqprvvlpstpasxvpyyhaejxehdlhckmwmibsjwqbmfzlwpjqjghmlxunefabkpryqxbkqridpqrzemvfcfcfcfcfc
47
Hint
Let be the length of string .
- For the first of the testdata, .
- For the first of the testdata, .
- For another of the testdata, it is guaranteed that you can obtain the correct answer without performing any rotation.
- For of the testdata, .
In addition, for the last of the testdata, it is guaranteed that the length of the non-random part of string does not exceed .
Note: This problem uses subtask scoring. The first of the testdata is subtask#1, and this subtask uses additive scoring (you may consider it as traditional scoring). The last of the testdata is subtask#2, and this subtask uses scoring (that is, if you get even one test wrong, you get points for the last points).
Translated by ChatGPT 5
京公网安备 11011102002149号