Konnichi wa, OIE-san P86489


pdf   zip


¿Who is not trying to learn japanese nowadays? For these people that, despite all our effort, do not achieved it, we always have the resort of learning to “japanize” our name. I explain myself: the language has 3 different alphabets: kanji, hiragana and katakana (“romaji”, that is the name that they use for our latin alphabet, is not included). Kanji is an ideographic alphabet: there are several thousands of symbols, and each symbol represents a concept. As the symbols do not represent phonemes like in our alphabet, we cannot use them easily to write foreign names in japanese. The other two alphabets, hiragana and katakana, are syllabic alphabets : each symbols represents a syllable. For simplicity, we will consider that a “japanese syllable” is formed by only a vowel (a, e, i, o, u) preceded, optionally, by a consonant (any of the other letters of our alphabet, including ‘h’ or ‘y’). We will only consider an exception: Japanese people accept that ‘n’ is, itself, a syllable.

Japanese syllables are so limited that we cannot write most of our names in Japanese: Pedro has a syllable “dro” that cannot be written in Japanese, “Guetiérrez” has “rr” and final “z”, etc. To “japanize” a name we will do the following process: always that we find a consonant (different than ‘n’) that is not followed by a vowel, we will insert a vowel ‘u’ immediately after. (In Japanese the vowel ‘u’ is a mute vowel.)

For instance: following the described rules, “Brat Pitt” is japonized as “Buratu Pitutu”, “Pedro Gutierrez” (we omit the accent) as “Peduro Gutierurezu”, and “Joe McEnroe” as “Joe MucEnroe”. “Angelina Jolie”, on the other hand, stays as it is.

Input The input consists of a line with a number n between 1 and 1000, followed by n lines, each one of them contains a number. A number is one or more words only formed by letters of the English alphabet (lowercase and uppercase letters, with no accents). The words are separated by a space. A word has, at most, 40 letters, and a name will never have more than 10 words.

Your program must solve 3 inputs like the described ones in one second.

Output The output consists of n lines following the format “Konnichi wa, NOMuBuRE-san”, where NOMuBuRE is the japanization of the read NAME. It must respect the capitalization of the read name, but the letters ‘u’ added must always be lowercase letters.

Hint Please, it must print the output correctly (“Konnichi” starts with an uppercase letter, after the comma there is a space, etc.), or the judge will reject your solution.

Public test cases
  • Input

    Brat Pitt
    Pedro Gutierrez
    Joe McEnroe Jr
    Edgar Ramirez III
    Angelina Jolie IV


    Konnichi wa, NOMuBuRE-san
    Konnichi wa, Buratu Pitutu-san
    Konnichi wa, Peduro Gutierurezu-san
    Konnichi wa, Joe MucEnroe Juru-san
    Konnichi wa, Edugaru Ramirezu III-san
    Konnichi wa, Angelina Jolie IVu-san
  • Information
    Omer Giménez
    Carlos Molina
    Original language
    Other languages
    Official solutions
    User solutions