词频
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
你想统计词频。
现在有一篇 行的文章(保证文章中的字母都是小写)以及一个待查找的单词,你需要数出这个单词在文中出现了多少次,单词首字母左侧应当是行首或空格,末字母右侧应当是行末或空格
“-” 表示一个连字符,保证它只出现在每行的行末,保证它只出现在字母后。
其他标点符号均应当视为空格。
输入格式
第一行一个整数 及一个只含小写字母的单词,分别表示文章的行数与待查找的词。
接下来 行,每行一个字符串,描述了这篇文章。
输出格式
一行一个整数,表示该单词在文中出现的次数。
样例1
2 qw
oqw qw;q-
w
2
样例2
4 abandon
abandon abandon banana
the get girlfriends, and t-
ry they just ab-
andon us?
3
数据范围
对于 的数据,,每行字符串长度不超过 。
开学摸底小测
- Status
- Done
- Rule
- IOI
- Problem
- 4
- Start at
- 2026-3-7 9:30
- End at
- 2026-3-7 11:30
- Duration
- 2 hour(s)
- Host
- Partic.
- 21