As a terrible Latin student for several years I have learned to hate many things about Latin. However there is one thing I love.
Scansion is the act of determining the meter of a particular line of poetry. For Latin this means demarcating each syllable in the line as "light" or "heavy".
In Latin scansion has many of rules. However unlike English Latin scansion is fairly regular and often requires no knowledge of Latin vocabulary or grammar to be performed. For this problem we will be using simplified subset of those rules (real Latin does not have a neat spec).
Before you begin the scansion you must elide. Elision is the dropping syllables between words to ease pronunciation. (e.g. "he is" -> "he's"). Unlike English, Latin elision follows very nice rules.
The final vowel of a word ending with a vowel is omitted if the next word begins with a vowel.
NAUTA EST -> NAUTEST
The same goes for words ending in a vowel followed by "m".
FIDUM AGRICOLAM -> FIDAGRICOLAM
Word-initial "h" followed by a vowel counts as a single vowel for elision purposes and is always dropped when elided.
MULTAE HORAE -> MULTORAE
MULTAM HORAM -> MULTORAM
After elision we can begin scansion. Scansion is done to a specific meter. The meter for this challenge is dactylic hexameter. Dactylic hexameter has six "feet" each foot consists of two or three syllables. Syllables can be either long or short depending on the vowel. Each of the first five feet will be either a dactyl, a long syllable followed by two short ones, or a spondee, two long syllables. And the last foot will be a long followed by an anceps (short or long, for this problem you will not have to determine which).
A vowel in latin can be either short or long
An "i" sandwiched between two vowels (e.g. eiectum) is a consonant. (i.e. a "j")
An "i" beginning a word followed by a vowel (e.g Iactus) is also a consonant
A "u" after a "q" is also a consonant (i.e. a "v")
Diphthongs (ae, au, ei, eu, oe, and ui) are made up of two vowels but count as one vowel and are always long
A vowel with two or more consonants between it and the next vowel is always long
For the previous rule an "l" or an "r" after a "b","c","d","g","p", or "t" does not count as a consonant
"x" counts as two consonants
"ch", "ph", "th", and "qu" count as one consonant
The syllable "que" at the end of a word (after elision) is always short
If a vowel is not forced by one of the previous rules it can be either long or short this will depend on the meter
Your task will be to take a line of latin and produce the scansion of it. You will take in the line as string via standard input and output a string representing the final scansion.
The input will contain only spaces and characters A-Z.
To represent the scansion you will output all of the syllables with
| demarcating the separation of feet. A long syllable will be represented by a
- while a short syllable will be marked by a
v and an anceps (the last syllable of every line) will be marked by a
x. If there are multiple solutions as there often will be you may output anyone of them.
The start of Virgil's Aeneid.
ARMA VIRUMQUE CANO TROIAE QUI PRIMUS AB ORIS -> -vv|-vv|--|--|-vv|-x (or -vv|-vv|--|-vv|--|-x) ITALIAM FATO PROFUGUS LAVINIAQUE VENIT -> -vv|--|-vv|-vv|-vv|-x LITORA MULTUM ILLE ET TERRIS IACTATUS ET ALTO -> -vv|--|--|--|-vv|-x VI SUPERUM SAEVAE MEMOREM IUNONIS OB IRAM -> -vv|--|-vv|--|-vv|-x (or -vv|--|-vv|-vv|--|-x) MULTA QUOQUE ET BELLO PASSUS DUM CONDERET URBEM -> -vv|--|--|--|-vv|-x INFERRETQUE DEOS LATIO GENUS UNDE LATINUM -> --|-vv|-vv|-vv|-vv|-x ALBANIQUE PATRES ATQUE ALTAE MOENIA ROMAE -> --|-vv|--|--|-vv|-x
In the proper fashion of Latin poetry all answers must begin with an invocation to the muses.
Latin has only two one letter words "e" and "a". You may assume that no other one letter words will appear as input.