  import io.Source
  import scala.collection.mutable

  object Main extends App {
    Source.stdin.getLines().foreach { s =>
      println(solve(s))
    }

    def solve(s: String): String = {
      // 総当り
      (1 to s.length - 1).foreach { i =>
        (i + 1 to s.length).foreach { j =>
          val ss = s.substring(i - 1, j)
//          println(s"ss = $ss, i = $i, j = $j")
          if (check(ss)) {
            return s"$i $j"
          }
        }
      }
      "-1 -1"
    }

    def check(s: String): Boolean = {
      val l = s.length
      val map = mutable.Map.empty[Char, Int]
      s.foreach { c =>
        if (map.contains(c)) {
          val cc = map(c)
//          println(s"s = $s, cc = ${cc + 1}, c = $c")
          if (cc + 1 > l / 2)
            return true
          map(c) = cc + 1
        } else {
          map += (c -> 1)
        }
      }
      false
    }
  }
