-- Try yukicoder -- author: Leonardone @ NEETSDKASU main = getLine >>= putStrLn . unwords . map show . solve 0 0 solve a b s | d == "(^^*)" = solve (a + 1) b t | d == "(*^^)" = solve a (b + 1) t | otherwise = [a, b] where (d, t) = splitAt 5 s