Apply seven ordered text transformations (lowercase, of-word replacement, vowel deletion, punctuation removal, line join, space condense, 20-char reflow) to translate English into Dudu's dialect.
Easy3StringImplementationSimulationNo attempts yetTime limit2sMemory limit512 MBDudu, 2015: "your uf of library have bugs"
Dudu decided that English is a very inefficient language, so he built his own dialect, dudu of english. Write a translator from English into dudu of english.
Apply the rules in this order.
A word is a run of characters delimited by spaces and line breaks. Every character that is not an uppercase letter, a lowercase letter, a space or a line break counts as punctuation.
The order changes the answer. The of-word test looks at the word as it stands right after rule 1, so to, with a comma attached is not an of-word. A word turned into of by rule 2 still goes through rule 3, but it has a single vowel, so it stays of.
A word with no letters left after rule 4 is not printed. Never print a space at the start of a line.
The first line has N, the number of lines to translate.
The next N lines hold the text to translate. Each of those lines contains printable ASCII characters only (codes 32 to 126).
Print the translated text. Words on the same line are separated by one space, and lines break according to rule 7.
If no word survives the rules, print nothing.
For rule 3, question. has the four vowels u, e, i, o, so the first two go away and it becomes qstion., and rule 4 drops the period, leaving qstion.
In rule 7 a line of exactly 20 characters does not break. The word that pushes the count above 20 stays on the line, and the break goes after it.