fun main(args: Array<String>) {
    val s = readLine()!!

    fun containsDup(s: String) : Boolean {
        val map = hashMapOf<Char, Int>()
        s.forEach {
            map[it] = map.getOrElse(it, { 0 }) + 1
            if (map[it]!! > s.length / 2) {
                return true
            }
        }
        return false
    }

    var size = 2
    for (i in 0 until s.length - 1) {
        if (containsDup(
                        s.substring(i, i + size)
                )) {
            print(i + 1)
            print(' ')
            print(i + size)
            return
        }
    }

    size = 3
    for (i in 0 until s.length - 2) {
        if (containsDup(
                        s.substring(i, i + size)
                )) {
            print(i + 1)
            print(' ')
            print(i + size)
            return
        }
    }
    println("-1 -1")
}