UberOA #8
Substrings of Length 3 With Exactly Two Vowels
Estimated EasyJudge-ready
Topics (AI-labelled)Two PointersStrings
Count the contiguous substrings of length exactly 3 that contain exactly two vowels; vowels are a, e, i, o, u, and substrings may overlap.
This site's standard input and output are explicit.
Input
One line containing a lowercase string of length 0..1000, which may be an empty line.
Output
Output one integer, the answer.
Example 1
Input:
welcome
Output:
1
Example 2
Input:
Output:
0
Example 3
Input:
banana
Output:
2
Example notes
Example 1: elc has only 1 vowel, lco only 1, wel also only 1, and com also only 1; ome has 2, so the correct result is 1, and the original site's 2 is wrong. Example 2: there is no substring of length 3, so output 0. Example 3: the two ana windows each have two a's, so output 2.
Editorial
Loading solution…