package net.ipipip0129.kotlin.yukicoder import kotlin.math.sign fun main(args: Array) { val lineData = readLine() val errorOutput = "Impossible" var charList = Array(13, {0}) // a-m以外お断り lineData!!.forEach { s -> run { if (s.toInt() in 97..109) { charList[s.toInt() - 97]++ } else { println(errorOutput) return } } } // 三つ以上の牌がないか if (charList.any { i -> 3 <= i }) { println(errorOutput) return } // ペアの数が0なら存在する牌を変えす // ペアの数が1なら存在しない牌を返す // ペアの数が2以上なら成立しないのでエラー when (charList.filter { i -> i == 2 }.size) { 0 -> { charList.forEachIndexed { index, i -> if (i == 1) println((index + 97).toChar())} } 1 -> { charList.forEachIndexed { index, i -> if (i == 0) println((index + 97).toChar())} } else -> { println(errorOutput) return } } }