Count the Syllables

Published by Mubashir Hassan in

Create a function that returns the number of syllables in a simple string. The string is made up of short repeated words like "Lalalalalalala" (which would have 7 syllables).

Examples

countSyllables("Hehehehehehe") ➞ 6

countSyllables("bobobobobobobobo") ➞ 8

countSyllables("NANANA") ➞ 3

Notes

  • For simplicity, please note that each syllable will consist of two letters only.
  • Your code should accept strings of any case (upper, lower and mixed case).
Watch a quick demo on how Edabit works.