Longest Substring
문제
For a string of length n ≥ 1 and a positive integer (1 ≤ k ≤ n), a non-empty substring of is called a -substring if the substring appears exactly times. Such occurrences are not necessarily disjoint, i.e., are possibly overlapping. For example, if "ababa", the -substrings of for every are as follows:
- There are four -substrings in ,
"abab","ababa","bab", and"baba"because these substrings appear exactly once in . Note that"aba"is not a -substring because it appears twice. - There are four -substrings in ,
"ab","aba","b", and"ba". The substring"ab"appears exactly twice without overlapping. Two occurrences of the substring"aba"are overlapped at a common character"a", but it does not appear three times or more. - There is only one -substring in ,
"a". - Neither -substrings nor -substrings exist in .
For a -substring of , let be the maximum number of the disjoint occurrences of in . For example, a -substring "ab" can be selected twice without overlapping, that is, the maximum number of the disjoint occurrences is two, so . For a -substring "aba", it cannot be selected twice without overlapping, so . For a -substring "a", it can be selected three times without overlapping, which is the maximum, so .
Let be the length of the longest one among all -substring with the largest for 1 ≤ k ≤ n. For example, for "ababa" and is as follows:
- For , all -substrings can be selected only once without overlapping, so . Thus, the longest one among all -substrings with is
"ababa", so . - For , for
"aba", but for the other -substrings"ab","b","ba". Among -substrings with ,"ab"and"ba"are the longest ones, so . - For , because there is only one -substring
"a". - For , there are no -substrings, so and .
Given a string of length , write a program to output values of from to . For the above example, the output should be .
입력
Your program is to read from standard input. The input starts with a line containing the string consisting of (1 ≤ n ≤ 50\,000) lowercase alphabets.
출력
Your program is to write to standard output. Print exactly one line. The line should contain exactly nonnegative integers, separated by a space, that represent from to in order, that is, . Note that should be zero if there is no -substring for some .
예제
예제 1
ababa
5 2 1 0 0
예제 2
aaaaaaaa
8 7 6 5 4 3 2 1