← Unit 2 · all exercises
Saved in this browser only

Count the vowels

Count how many vowels are in the text. Vowels are a, e, i, o and u, in either case.

int countVowels(String text)

Solution.java
Loading editor…
Results

Examples

  • countVowels(hello) → 2
  • countVowels(java) → 2

There are also 4 hidden tests you can't see. Solve the problem, not the examples.