QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#1897. 俳句

统计

俳句(Haiku)是一种起源于日本的短诗。传统的俳句由三句组成,共包含 17 个音节单位。其中第一句包含 5 个音节单位,第二句包含 7 个音节单位,最后一句包含 5 个音节单位。

你找到了一篇关于俳句的长文,但文中没有换行符。你已经将文本拆分成了单词,现在你想找出其中所有潜在的俳句:即可以构成俳句的连续单词片段。

为简化起见,本题采用以下约定:单词是由小写英文字母组成的序列。音节单位(phonetic unit)是连续元音的序列。元音字母为 "a"、"e"、"i"、"o" 和 "u"。例如,单词 "contest" 包含两个音节单位,单词 "beautiful" 包含三个音节单位。

本题要求找出连续单词片段的数量,使得如果在这些片段的任意两个单词之后添加换行符,就能构成一个俳句。

例如,在文本 "if the real beauties of sunset in a suspended moment call for the thunder forever" 中,有两个潜在的俳句:

the real beauties of sunset in a suspended moment call for the

以及

beauties of sunset in a suspended moment call for the thunder

输入格式

第一行包含一个整数 $n$ —— 你找到的文本中的单词数量 ($1 \le n \le 10^5$)。 接下来的 $n$ 行包含由小写字母组成的单词。每个单词的长度不超过 20。保证每个单词至少包含一个音节单位。

输出格式

输出文本中潜在俳句的数量。

样例

样例输入 1

15
if
the
real
beauties
of
sunset
in
a
suspended
moment
call
for
the
thunder
forever

样例输出 1

2

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.