format :: Int -> Int -> String
format i j = show i ++ " " ++ show j

solve (s:ss:[]) i j = format (-1) (-1)
solve (s:ss:sss) i j
  | s == ss = format i j
  | s == head sss = format i $ j + 1
  | otherwise = solve (ss:sss) (i + 1) (j + 1)

main = do
  s <- getLine
  putStrLn $ solve s 1 2
