10
0
In Skyrim, the player character can use powerful magic shouts (Thu'ums) to achieve their goals. Every shout consists of three words, however, the player can use the first one or two words to achieve the same effect with less power but at a shorter cooldown.
Given a lowercase ASCII Thu'um phrase without punctuation or spaces, return how many words of power it contains.
Example:
fusrodah -> 3
dur -> 1
kaandrem -> 2
odah -> 2
vengaarnos -> 3
The input will always be a lowercase ASCII string formed by taking one of the shouts below, choosing the first 1, 2, or 3 words from that shout, and concatenating the words in order.
dur neh viir
faas ru maar
feim zii gron
fo krah diin
fus ro dah
gaan lah haas
gol hah dov
hun kaal zoor
iiz slen nus
joor zah frul
kaan drem ov
krii lun aus
laas yah nir
lok vah koor
mid vur shaan
mul qah diiv
od ah viing
raan mir tah
rii vaaz zol
strun bah qo
su grah dun
tiid klo ul
ven gaar nos
wuld nah kest
yol toor shul
zul mey gut
zun haal viik
So fus
, fusro
, and fusrodah
are all valid inputs, but fusroviir
isn't because it uses words from mixed shouts, and rodah
isn't because it's not a prefix of a shout. You also don't have to handle the empty string input.
Shortest code in bytes wins.
1I will give a cookie for the first person to run this algorithm on each line of the Song of the Dragonborn (known as the "skyrim theme" by plebs) – Cyoce – 2016-02-14T08:18:56.210