How to solve the Codewars's Vowel Count

Today I try to solve the algorithm problem of codewars.


Return the number of vowels in the given string.

We will consider a, e, i, o, and u as vowels for this Kata.

The input string will only consist of lower case letters and/or spaces.


  • split : returns array of strings computed by splitting.

  • equals : returns true if the String are equal.

public class Vowels {

  public static int getCount(String str) {
    int vowelsCount = 0;
    String[] arr = str.split("");
    for(String i : arr){
    return vowelsCount;

Written on December 2, 2018