@JvmField val INPUT = System.`in` @JvmField val OUTPUT = System.out @JvmField val _reader = INPUT.bufferedReader() fun readLine(): String? = _reader.readLine() fun readL() = _reader.readLine()!! fun solve(line: String): Boolean { if(line.isEmpty()) return false var s = line.toLowerCase(); for (i in 0 until 3){ if(s.isEmpty()) return false if(!s.last().isLetterOrDigit()) s = s.dropLast(1) } if(s.isEmpty()) return false if (line.startsWith("digi ")){ return s.endsWith("nyo") && s != "digi" }else if (line.startsWith("petit ")){ return s.endsWith("nyu") && s != "nyu" }else if(line.startsWith("rabi ")){ return s.length >= 5 && s.subSequence(5, s.length).any { it.isLetterOrDigit()} }else if(line.startsWith("gema ")){ return s.endsWith("gema") && s != "gema" }else if(line.startsWith("piyo ")) return s.endsWith("pyo") && s != "pyo" else return false } fun main(args: Array) { var s : String? do { s = readLine() if(s == null) break println( if (solve(s)) "CORRECT (maybe)" else "WRONG!") } while (true) }