← Coding round practice

Count Vowels in a String

EasyStrings

The problem

Count how many vowels (a, e, i, o, u) appear in a string, ignoring case.

Sample input

education

Sample output

5
Show the solution · 8 languages
fun main() {
    val s = "education"
    val count = s.count { it.lowercaseChar() in "aeiou" }
    println(count)
}