main = do
    s <- getLine
    let xs = zip s [1..]
    let (a,b) = solve xs
    putStr $ show a
    putStr " "
    putStrLn $ show b

solve [] = (-1,-1)
solve (_:[]) = (-1,-1)
solve ((a,l):(b,m):[]) | a == b = (l,m)
                       | otherwise = (-1,-1)
solve ((a,l):(b,m):(c,n):ys) | a == b = (l,m)
                             | a == c = (l,n)
                             | otherwise = solve ((b,m):(c,n):ys)