ง่าย 0 ข้อที่แก้แล้ว อัตราผ่าน 0%

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.

เงื่อนไข

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 กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน

เรียนรู้จากคนอื่น

แนวทางจากชุมชน

ยังไม่มีวิธีทำที่เผยแพร่ ลองแก้โจทย์นี้เพื่อแชร์วิธีแรก