Easy 0 solved 0% acceptance

Count Vowels

Count the vowels in a piece of text.

Problem

Count how many characters in text are vowels: a, e, i, o, u in either uppercase or lowercase.

Implement count_vowels(text).

Input

text: The text to inspect (ASCII characters).

Output

Return the number of vowels.

Constraints

0 ≤ length ≤ 10,000

Examples

Example 1
Input:
text = "Hello World"

Expected output:
expected = 3
Input:
std::string text = "Hello World";

Expected output:
long long expected = 3;
Input:
string text = "Hello World";

Expected output:
long expected = 3;

Explanation

e, o and o are vowels: 3.

Example 2
Input:
text = "AEIOU and y"

Expected output:
expected = 6
Input:
std::string text = "AEIOU and y";

Expected output:
long long expected = 6;
Input:
string text = "AEIOU and y";

Expected output:
long expected = 6;

Explanation

A, E, I, O, U, a are vowels; y is not counted: 6.

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.