let array_of_string s = Array.init (String.length s) (fun i -> s.[i])

let () =
  try
    read_line ()
    |> array_of_string
    |> (fun a ->
        Array.to_list (Array.init (Array.length a - 1) (fun i -> ((i + 1, i + 2), a.(i) = a.(i + 1)))) @
        Array.to_list (Array.init (Array.length a - 2) (fun i -> ((i + 1, i + 3), a.(i) = a.(i + 2)))))
    |> List.find (fun (_, b) -> b)
    |> (fun ((i, j), _) -> Printf.printf "%d %d\n" i j)
  with Not_found -> print_endline "-1 -1"