Recursion: Count Vowels

Published by Helen Yu in

Write a function that recursively returns the number of vowels in a string.

Examples

count_vowels("apple") ➞ 2

count_vowels("cheesecake") ➞ 5

count_vowels("bbb") ➞ 0

count_vowels("") ➞ 0

Notes

  • All letters will be in lower case.
  • Vowels are: a, e, i, o, u.
Watch a quick demo on how Edabit works.