Vowel Families

Published by Mubashir Hassan in

Write a function that selects all words that have all the same vowels (in any order and/or number) as the first word, including the first word.

Examples

sameVowelGroup(["toe", "ocelot", "maniac"]) ➞ ["toe", "ocelot"]

sameVowelGroup(["many", "carriage", "emit", "apricot", "animal"]) ➞ ["many"]

sameVowelGroup(["hoops", "chuff", "bot", "bottom"]) ➞ ["hoops", "bot", "bottom"]

Notes

  • Words will contain only lowercase letters, and may contain whitespaces.
  • Frequency does not matter (e.g. if the first word is "loopy", then you can include words with any number of o's, so long as they only contain o's, and not any other vowels).
Watch a quick demo on how Edabit works.