object Main extends App {
  import scala.util.control.Breaks

  def solve(s: String): (Int, Int) = {
    val checkTwo   = s.toCharArray.sliding(2).forall(l => l.head != l.tail.head)
    val checkThree = s.toCharArray.sliding(3).forall(l => l.head != l.tail.last)
    if (checkTwo && checkThree) (-1, -1)
    else {
      val b1    = new Breaks
      var start = -1
      var end   = -1
      b1.breakable {
        for ((e, i) <- s.toCharArray.sliding(2).zipWithIndex) {
          if (e.head == e.tail.head) {
            start = i
            end = i + 1
            b1.break
          }
        }
      }
      val b2 = new Breaks
      b2.breakable {
        for ((e, i) <- s.toCharArray.sliding(3).zipWithIndex) {
          if (e.head == e.tail.last) {
            start = i
            end = i + 2
            b2.break
          }
        }
      }
      (start, end)
    }
  }

  val sc = new java.util.Scanner(Console.in)
  val s  = sc.next()
  val t  = solve(s)
  println(s"${t._1} ${t._2}")
}