Tutte le sfide
Facile 0 risolte 0% di accettazione

Count Vowels

Count the vowels in a piece of text.

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.

Vincoli

0 ≤ length ≤ 10,000

Esempi

Esempio 1
Input:
text = "Hello World"

Output atteso:
expected = 3
Input:
std::string text = "Hello World";

Output atteso:
long long expected = 3;
Input:
string text = "Hello World";

Output atteso:
long expected = 3;

Spiegazione

e, o and o are vowels: 3.

Esempio 2
Input:
text = "AEIOU and y"

Output atteso:
expected = 6
Input:
std::string text = "AEIOU and y";

Output atteso:
long long expected = 6;
Input:
string text = "AEIOU and y";

Output atteso:
long expected = 6;

Spiegazione

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

Riferimenti

Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.

Impara dagli altri

Soluzioni della community

Nessuna soluzione pubblicata. Risolvi questa sfida per condividere la prima.