#P3966. [TJOI2013] 单词

    ID: 2801 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2013二分各省省选概率论,统计AC 自动机天津

[TJOI2013] 单词

Description

Xiao Zhang has been busy with his graduation project, so he has been reading papers. A paper is composed of many words, but Xiao Zhang noticed that a word may appear many times in the paper. He wants to know how many times each word appears in the paper.

Input Format

The first line contains an integer NN, indicating that the article has NN words.

Then the next NN lines each contain one word. Each word consists of lowercase letters aza\sim z.

Output Format

Output NN integers, where the i-th line is the number of times the i-th word appears in the article.

3
a
aa
aaa
6
3
1

Hint

Constraints

  • For 30% of the testdata, the total length of all words does not exceed 10310^3.
  • For 100% of the testdata, 1N2001 \leq N \leq 200, and the total length of all words does not exceed 10610^6.

Translated by ChatGPT 5