#P10420. [蓝桥杯 2023 国 A] 子串

    ID: 13472 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度省选/NOI− 上传者: 标签>2023后缀自动机 SAM蓝桥杯国赛

[蓝桥杯 2023 国 A] 子串

Problem Description

Given a string SS consisting only of lowercase English letters, ask how many distinct strings appear in SS exactly 1∼∣S∣1 \sim |S| times. If two strings differ in length or in the character at any position, we consider them different.

Input Format

Input one line containing a string SS, consisting of lowercase English letters.

Output Format

Output ∣S∣|S| lines, each containing an integer. The integer on line ii denotes the number of strings that appear exactly ii times in SS.

abb

4
1
0

Hint

[Sample Explanation 1]

a, ab, bb, abb appear once, and b appears twice.

[Test Case Size and Conventions]

For 20%20\% of the test cases, ∣S∣≤300|S| \le 300.
For 40%40\% of the test cases, ∣S∣≤5000|S| \le 5000.
For all test cases, 1≤∣S∣≤1061 \le |S| \le 10^6.

Translated by ChatGPT 5