import kotlin.system.exitProcess val br = System.`in`.bufferedReader() fun readLine(): String? = br.readLine() fun readString() = readLine()!! const val MAX_STACK_SIZE: Long = 128 * 1024 * 1024 fun main() { val thread = Thread(null, ::run, "solve", MAX_STACK_SIZE) thread.setUncaughtExceptionHandler { _, e -> e.printStackTrace(); exitProcess(1) } thread.start() } fun run() { val S = readString() output(solve(S)) } fun solve(S: String): Pair { if (S[0] == S[1]) { for (i in 2..S.lastIndex) if (S[i] != S[0]) return i + 1 to S[i] } if (S[0] == S.last()) return 2 to S[1] return 1 to S[0] } fun output(res: Pair) = res.apply { println("$first $second") }