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

solve (s:ss:sss) i j =
    if s == ss
      then format i j
      else if sss == []
             then format (-1) (-1)
             else if s == head sss
                    then format i $ j + 1
                    else solve (ss:sss) (i + 1) (j + 1)

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