#P4341. [BJWC2010] 外星联络
[BJWC2010] 外星联络
Description
After watching the movie "Contact" (超时空接触), Little P was deeply moved and decided to devote himself to the search for extraterrestrial life. Every night, he climbs onto the roof and tries to use his radio to listen for messages from aliens.
Although he hears only noise, he still rewrites the received signal into a string of 0s and 1s according to the high and low levels of the noise, and firmly believes that the aliens' message is hidden within. He believes that the message sent by the aliens must repeat within the binary string he received, so he wants to find all substrings of the binary string that appear more than time.
However, the signal string he received is too long, so he hopes you can write a program to help him.
Input Format
The first line contains an integer , the length of the received signal string.
The second line contains a binary string of length , representing the received signal string.
Output Format
Output one line for each substring that appears more than time, containing its number of occurrences. Output the lines in lexicographical order of the corresponding substrings.
7
1010101
3
3
2
2
4
3
3
2
2
Hint
For 100% of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号