object Main extends App {

  import scala.io.StdIn.readLine
  val arr = readLine().trim.split("")
  val m = scala.collection.mutable.Map[String, Int]()
  arr.foreach { e =>
    if (m.contains(e)) {
      m(e) = m(e) + 1
    } else {
      m(e) = 1
    }
  }
  val _v = m.values.max

  var t = ("", 0)
  m.foreach { case (k, v) =>
    if (v == _v) {
      t = (k, v)
    } else {
      ()
    }
  }
  println(s"${arr.mkString.indexOf(t._1) + 1} ${arr.mkString.lastIndexOf(t._1) + 1}")

}
