P3526 [POI 2011] OKR-Periodicity
题目描述
Byteasar, the king of Bitotia, has ordained a reform of his subjects' names.
The names of Bitotians often contain repeating phrases, e.g., the name Abiabuabiab has two occurrences of the phrase abiab. Byteasar intends to change the names of his subjects to sequences of bits matching the lengths of their original names.
Also, he would very much like to reflect the original repetitions in the new names.
In the following, for simplicity, we will identify the upper- and lower-case letters in the names. For any sequence of characters (letters or bits)  we say that the integer  () is a period of  if  for all .
We denote the set of all periods of  by .
For example, , , and .
Byteasar has decided that every name is to be changed to a sequence of bits that:
has length matching that of the original name, has the same set of periods as the original name, is the smallest (lexicographically1) sequence of bits satisfying the previous conditions.
For example, the name ABIABUABIAB should be changed to 01001101001, BABBAB to 010010, and BABURBAB to 01000010.
Byteasar has asked you to write a program that would facilitate the translation of his subjects' current names into new ones.
If you succeed, you may keep your current name as a reward!
输入格式
无
输出格式
无