import java.util.Scanner fun duplication(input: List): MutableList{ var list: MutableList = mutableListOf() for(i in 0..input.count() - 2){ if( !(input[i] in list) ) list.add(input[i]) } return list } fun charaCount(input: List, duplicationList: MutableList): MutableList{ var countList: MutableList = mutableListOf() for(item in duplicationList){ var count: Int = 0 for(i in 0..input.count() - 2){ if(item == input[i]) count++ } countList.add(count) } return countList } fun run(duplicationList: MutableList, countList: MutableList){ var flag: Boolean = false var result: MutableList = mutableListOf() for(i in 0..countList.count() - 1){ if(countList[i] > 2){ flag = false break } else if(countList[i] == 1){ result.add(duplicationList[i]) flag = true } } if(flag == true && result.count() == 1) println(result[0]) else println("Impossible") } fun main(args: Array){ var input = (Scanner(System. `in`).next()).split(Regex("")) var duplicationList = duplication(input) var countList = charaCount(input, duplicationList) run(duplicationList, countList) }