English is such an inefficient language. We've got enormous words when there are plenty of two or three letter words we never used! As computer scientists, every keystroke matters. We need to be more efficient. Just think of how many words we could have had! In fact, don't think about it, tell me.
Given a string (or list) of letters, I want you to output how many words we could make using those letters. You must use every letter in the string exactly one time.
Words can't just be any old string of letters though, how would you say "yffghtjrufhr"? To be a word, it has to satisfy the following conditions:
- It must contain at least one vowel ('y' is always a vowel).
- There must be no more than 2 vowels in a row.
- There must be no more than 3 consonants in row.
- The combinations "ch", "sh", and "th" count as one consonant.
- "s" counts as neither a consonant nor vowel ("length" is just as valid as "lengths").
Input -> Output a -> 1 (a) b -> 0 ab -> 2 (ab, ba) abbbb -> 3 (babbb, bbabb, bbbab) abbbbbbb -> 0 essss -> 5 (essss, sesss, ssess, ssses, sssse) abbbth -> 46 (thabbb, thbabb, thbbab, bathbb, ...)
Obviously, since this challenge is all about character efficiency, I think a code-golf challenge is in order. Standard rules apply!
(For clarification, an 's' breaks any streaks of vowels or consonants. The word "abbbsbbb" is ok, since there are no more than 3 consonants in a row".)