cswork / OA打开练习工作台

IBMOA #7

Vowel-Bookended Strings (Range Queries)

估计中等可在线判题

考点(AI 标注)前缀和区间字符串

Each query gives a 1-based closed interval l-r; count the strings in it whose first and last characters are both lowercase vowels aeiou. A single-character vowel qualifies.

输入格式

The first line contains n q, followed by n lines of non-empty lowercase strings, then q lines of l-r. On this site n,q≤100000, total characters ≤10^6, 1≤l≤r≤n.

输出格式

Output q integers in query order.

样例 1

输入:

5 2
aba
bcb
ece
aa
e
1-3
2-5

输出:

2 3

样例 2

输入:

1 1
a
1-1

输出:

1

样例 3

输入:

2 1
ab
ba
1-2

输出:

0

样例说明

The examples give 2 3; 1; and 0 respectively.