luogu#P16602. [SYSUCPC 2025] SYSU II
[SYSUCPC 2025] SYSU II
Problem Description
As you all know, you are participating in the SYSUCPC (SYSU Counting Periodic-string Contest) finals.
A string is considered if and only if it can be rearranged into a perfectly periodic string with as its period (which means several repetitions). For example, are all , while are not. Given a string , determine how many of its substrings are .
A string is a substring of a string if can be obtained from by the deletion of several (possibly zero or all) characters from the beginning and several (possibly zero or all) characters from the end.
Input Format
The only line contains a single string . It is guaranteed that only contains lowercase English letters.
Output Format
An integer, representing the number of substrings of .
ilovesysusysu
6
Hint
There are substrings : .