main :: IO ()
main = do
  s <- getLine
  let
    solve _ [] = (-1, -1)
    solve _ [_] = (-1, -1)
    solve n [x, y] = if x == y then (n, n+1) else (-1, -1)
    solve n (x:y:z:xs)
      | x == y = (n, n+1)
      | x == z = (n, n+2)
      | otherwise = solve (n+1) (y:z:xs)
  putStrLn $ (\(x, y) -> show x ++ " " ++ show y) $ solve 1 s
