Under construction

Still being built. Things may change

Dudu of English

Time limit2sMemory limit512 MB

Summary
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.
Level

Easy3 of 10

Topics
String, Implementation, Simulation
Solved
No attempts yet

Problem

Dudu, 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.

  1. Decapitalize every capital letter. Speakers of dudu of english are humble.
  2. Prepositions are overrated, and Dudu decided that certain words mean pretty much the same thing. Those words are the of-words, and each one becomes of. The of-words are of, to, into, onto, above, below, from, by, is, at.
  3. Dudu thinks vowels do not improve readability. If a word has KK vowels, delete the first ⌊K/2⌋\lfloor K/2 \rfloor of them. The vowels are a, e, i, o, u.
  4. Delete every punctuation character.
  5. Delete every line break in the input and put a space in its place.
  6. Condense any run of spaces into a single space. Dudu is not wasteful.
  7. Dudu prefers short lines but does not want words broken apart. While printing, if a word makes the current line longer than 20 characters, break the line right after that word. Spaces do not count toward the length.

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.

Input

The first line has NN, the number of lines to translate.

The next NN lines hold the text to translate. Each of those lines contains printable ASCII characters only (codes 32 to 126).

  • 1≤N≤501 \le N \le 50
  • The total length of the text to translate is at most 5000 characters.

Output

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.

Hint

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.

Examples2

  1. Example 1

    Input
    3
    Output the text from the input, translated into dudu of English.
    To Kill a Mockingbird.
    To be or not to be, that is the question.
    
    Expected output
    utput the text of the nput 
    trnslated of ddu of nglish 
    of kill a mckingbird of be 
    or not of be that of the qstion
    
  2. Example 2

    Input
    1
    To, is: at! by? from-
    
    Expected output
    to is at by from