G: Sonnet Rhyme Verifier |
According to Wikipedia
The term sonnet derives from the Provencal word sonet and the Italian word sonetto, both meaning ``little song''. By the thirteenth century, it had come to signify a poem of fourteen lines that follows a strict rhyme scheme and logical structure. The conventions associated with the sonnet have evolved over its history. The writers of sonnets are known as sonneteers.
Written in Spanish, sonnets have a well defined structure over the rhymes. Moreover, these days sonneteers are scarce as good weather and the rules governing the rhymes are rather permissive. Let us consider the following poem:
ES ELLA Locura, intensa y sin medida andando errante te avisté, una nota en tus manos encontré: rumor de un amor y su partida. Adelante, te diré de su vida aunque en mi regazo ya no esté, fueron sus labios con que tropecé los que te llamaron despavorida. Ojos negros, pestañas en un ramo, rizos finos, humor, siempre bella; ¡es ella, amiga, a quien amo! Zagales de secretos sus estrellas, cómplices la lluvia y el álamo; ... es ella, nuestra musa, ¡es ella!
This poem must be consider as sonnet because it meets the following rules:
Today you are to help the local Spanish School of Sonneteers (SSS) writing a program that verifies if a given composition sticks to the first two rules of a Spanish sonnet. The last rule is to be checked by the SSS's master sonneteer once the given poem passes the tests exercised by the verifier you are about to code.
For the purpose of your work, two lines rhyme if, after cleaning them,
they have the same suffix. Given a line in the sonnet, its clean version is the result of deleting blanks, punctuation symbols (¡, !, ,, ., :, ;, ¿, ?, -) and the last s
The input consists of several instances of the problem, each one occurring
separated by a new line. Each instance consists of n > 2
For each problem instance, and according to the order of the input, your
program should print a sentence of the form
< NAME >
if
the given composition adheres to the first two rules of a spanish sonnet or
< NAME >
in other case, where < NAME >
Input
Output
Sample Input
ida é amo ella
ES ELLA
Locura, intensa y sin medida
andando errante te avisté,
una nota en tus manos encontré:
rumor de un amor y su partida.
Adelante, te diré de su vida
aunque en mi regazo ya no esté,
fueron sus labios con que tropecé
los que te llamaron despavorida.
Ojos negros, pestañas en un ramo,
rizos finos, humor, siempre bella;
¡es ella, amiga, a quien amo!
Zagales de secretos sus estrellas,
cómplices la lluvia y el álamo;
... es ella, nuestra musa, ¡es ella!
ura ima illa eto
OTrO
Esta composición posiblemente rima
pero nunca será un soneto
con esta frase ya no sirve
ni tampoco porque está incompleto.
Sample Output
ES ELLA: ABBAABBACDCDCD
OTrO: Not a chance!