समस्या
अनुवाद दिखाएँ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.
सीमाएँ
0 ≤ length ≤ 10,000
उदाहरण
उदाहरण 1
इनपुट:
text = "Hello World"
अपेक्षित आउटपुट:
expected = 3
इनपुट:
std::string text = "Hello World";
अपेक्षित आउटपुट:
long long expected = 3;
इनपुट:
string text = "Hello World";
अपेक्षित आउटपुट:
long expected = 3;
व्याख्या
e, o and o are vowels: 3.
उदाहरण 2
इनपुट:
text = "AEIOU and y"
अपेक्षित आउटपुट:
expected = 6
इनपुट:
std::string text = "AEIOU and y";
अपेक्षित आउटपुट:
long long expected = 6;
इनपुट:
string text = "AEIOU and y";
अपेक्षित आउटपुट:
long expected = 6;
व्याख्या
A, E, I, O, U, a are vowels; y is not counted: 6.
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।