In Irish, most consonants are divided into broad (velarized) and slender (palatalized) variants, and the orthography marks them with neighboring vowels, which are similarly divided. This gives rise to the caol le caol agus leathan le leathan (slender with slender and broad with broad) rule – a medial sequence of consonants must have the same class of vowel on either side: in leabhar, bh is surrounded by two broad vowels, so it is broad as well, and in cailín, l is surrounded by two slender vowels, so it is slender. a, o and u are broad and e and i are slender (similar with the vowels with the fada: á ó ú é í); ae (but not áe, aé, or áé) is also considered broad.
Given a word, output whether it follows this rule.
Input
You may assume that the input has only the following characters with their uppercase variants:
aábcdeéfghiílmnoóprstuú
AÁBCDEÉFGHIÍLMNOÓPRSTUÚ
Input will be given in the NFC normalization form.
Tests
Valid:
deartháireacha
madra
nuachtán
gaolta
ceannasaithe
snámhann
fómhair
laethanta
béar
Bealtaine
hAoine
ball
tree
ggg
laEthanta
agus
úsáideoir
Invalid:
codegolf
delta
alishanoi
ABI
anseo
breithlá
aéco
áeco
áéco
(Note that anseo and breithlá are Irish words, but they happen not to follow this rule. You should still output a falsy answer for them for the sake of simplicity.)
aé
,áe
, andáé
are used in Irish at all. I’ll say that onlyae
should be. \$\endgroup\$ggg
isn't an Irish word and that's listed as a "valid" Irish word in the examples. While the title refers to being a "valid Irish word", the purpose of the exercise solely focuses on the slender/broad division for its vowels. It's not asking to vet any other spelling, nor to check if the word itself exists in an Irish dictionary. We're only asked to apply the broad/slender rule. Non-existing words can still be judged for correctness on broad/slender. If your interpretation were correct then the valid examples would only contain actual Irish words, which is not the case. \$\endgroup\$