MathWorksOA #13
Has Vowels
EasyJudge-ready
Topics (AI-labelled)Prefix & RangesStrings
Given an array of lowercase strings. A closed-range query [i,r] (1-based) asks how many strings in it both start and end with a vowel a/e/i/o/u.
See below for this site's input/output protocol.
Input
The first line contains n q; the next line contains n non-empty lowercase strings; then q lines follow, each i-r. 1≤n,q≤100000, string length 1..10, 1≤i≤r≤n.
Output
Output the answer to each query on its own line.
Example 1
Input:
5 3
aba bcb ece aa e
1-3
2-5
2-2
Output:
2 3 0
Example 2
Input:
3 3
a b u
1-1
2-3
1-3
Output:
1 1 2
Example 3
Input:
2 3
abc xyz
1-2
2-2
1-1
Output:
0 0 0
Editorial
Loading solution…