import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.Map.Strict as Map

type I = Int

main :: IO ()
main = do
  xs <- getLine
  putStrLn . (\(a,b) -> show a ++ " " ++ show b) $ solve xs

solve :: String -> (I, I)
solve xs = case find unbalanced $ substrings xs of
  Just x -> case elemIndex True . map (isPrefixOf x) $ tails xs of
    Just i -> (i+1, i + length x)
    Nothing -> (-1, -1)
  Nothing -> (-1, -1)

unbalanced :: String -> Bool
unbalanced xs = length xs > 1 && maxsize xs * 2 > length xs where
  maxsize = maximum . map length . group . sort

substrings :: Eq a => [a] -> [[a]]
substrings = nub . concat . map inits . tails

--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

readi :: String -> I
readi = read

toTuple :: [a] -> (a, a)
toTuple [x, y] = (x, y)

toTriple :: [a] -> (a, a, a)
toTriple [x, y, z] = (x, y, z)
