import Control.Applicative import Data.List main :: IO () main = solve <$> getLine >>= putStrLn solve :: String -> String solve xs = f $ foldl' count (0,0) (tails xs) where f (x, y) = unwords . map show $ [x, y] data Face = L0 | L1 | L2 | L3 | R0 | R1 | R2 | R3 left L0 '^' = L1 left L1 '^' = L2 left L2 '*' = L3 left s _ = s right R0 '*' = R1 right R1 '^' = R2 right R2 '^' = R3 right s _ = s point L3 = 1 point R3 = 1 point s = 0 count :: (Int, Int) -> String -> (Int, Int) count (l, r) ('(':xs) = let (x,y,_,_) = foldl' f (l, r, L0, R0) xs in (x, y) where f (cl, cr, sl, sr) c | c == ')' = (cl + point sl, cr + point sr, sl, sr) | otherwise = (cl, cr, left sl c, right sr c) count (l, r) _ = (l, r)