TLE '16 Contest 5 P1 - English Proficiency Exam

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Your teacher wants to avoid hard-to-pronounce words such as "zqfmgb".

A former English teacher of yours needs your help! You don't want to disappoint this very nice teacher (she gave you a 94), so you have decided to help her.

Your teacher is writing an English proficiency exam for her class. One part of the exam involves reading aloud. For this section, your teacher has generated some text consisting of space-separated words only consisting of lowercase English letters. Since your teacher is nice, she wants to make sure that all of the words are readable, especially for students whose first language is not English.

A word is readable if it alternates vowels (a, e, i, o, and u) and consonants (all of the other letters). If a word is one character long, it must be a vowel. Examples of readable words are dapubokideb, u, and oke.

Currently, not all of the words might be readable. For each unreadable word, your teacher will continue to try to swap two adjacent characters until the word becomes readable. Since she doesn't want you doing all of the work for her, she simply wants you to tell her if it is possible or not. Can you help your teacher?

Input Specification

The first and only line of input will contain the text, which consists of space-separated words. The length of the text, including spaces, will not exceed 10^5 characters.

For 30% of the points, only 1 word will be present in the text and the input will contain a maximum of 5 characters.

For another 30% of the points, the input will contain a maximum of 10 characters.

Output Specification

Output readable if your teacher can make all words readable through swapping. Otherwise, output not readable.

Sample Input 1

aba caba daba caba kke

Sample Output 1


Explanation for Sample Output 1

All words are initially readable except for kke. The word can be made readable by swapping the second and third characters to form kek.

Sample Input 2

my handwriting

Sample Output 2

not readable


  • -1
    45628andy  commented on Jan. 27, 2017, 12:29 a.m.

    Sorry for asking but I have no idea about where I did wrong. Can someone help me?

  • 2
    jlsajfj  commented on Jan. 19, 2017, 6:52 p.m.

    Man Jlsajfj must be horribly not readable