Write a method that takes a string and returns the number of vowels in the string. You may assume that all the letters are lower cased. You can treat “y” as a consonant.
Note: I overcomplicated this problem in my mind. Remember to use += 1 to count something.
Second time solving this:
I forgot to initialize count to 0 (I apparently forgot the first time as well) and I also started off splitting the string into letters, which was unnecessary.
Third time, using a hash map (with the help of Josh)!
By using hash, it would be more efficient to add more vowels later.