import qualified Data.List as List
import qualified Data.Maybe as Maybe

rec :: Int -> ([Char] -> Int) -> [Char] -> [Int]
rec n func (x:xs)
  | length xs   == 0   = [-1,-1]
  | func (x:xs) == 0   = [n+1,n+2]
  | func (x:xs) == 1   = [n+1,n+3]
  | otherwise          = rec (n+1) func xs

solve :: [Char] -> Int
solve (x:xs) = (\a -> if a == Nothing then -1 else Maybe.fromJust a) $
  List.elemIndex x xs


main :: IO ()
main = getLine >>=
  putStrLn .
  (\ [s,e] -> (show s) ++ " " ++ (show e)) .
  (\ xs -> rec 0 solve xs)