QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#6181. Repeated Function Problem

統計

Given a string $S$ consisting of $n$ lowercase English letters, its repetition function $f_S(x)$ is defined as follows:

  • For a positive integer $1 \leq i \leq n$, the value of $f_S(i)$ is the longest substring $A$ of $S$ such that $S$ can be represented as $S = A\#A\# \cdots A \#A$, where the string $A$ appears exactly $i$ times, and each $\#$ can be any string (including the empty string). If no such substring $A$ exists, $f_S(i)$ is an empty string.

Repetition Function Problem: For a given string $S$ consisting of $n$ lowercase English letters, calculate the length $|f_S(i)|$ of the function $f_S(i)$ for all $2 \leq i \leq n$.

Input

The first line of the input contains a string $S$ consisting of lowercase English letters.

Output

Output the lengths $|f_S(i)|$ for the $n-1$ substrings $f_S(i)$ in order, for $2 \leq i \leq n$.

Examples

Input 1

abaabacdabaaba

Output 1

6 3 3 1 1 1 1 0 0 0 0 0 0

Subtasks

$10\%$ of the test data satisfies $n \leq 300$.

$30\%$ of the test data satisfies $n \leq 3\,000$.

$80\%$ of the test data satisfies $n \leq 200\,000$.

$100\%$ of the test data satisfies $n \leq 1\,000\,000$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.