let s = read_line ()
let f l r = Printf.printf "%d %d\n" (l + 1) (r + 1); exit 0
let _ = String.(iteri (fun i c -> if i > 0 && s.[i - 1] = c then f (i - 1) i) s; iteri (fun i c -> if i > 1 && s.[i - 2] = c then f (i - 2) i) s); print_endline "-1 -1"