import Data.List
import Data.Function

main = putStrLn . unwords . map show . solve =<< getLine

solve :: String -> [Int]
solve = maybe [-1,-1] (\((i,_):xs) -> [i,i+1]) . find ((>1) . length) . groupBy ((==) `on` snd) . zip [1..]

