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