hanten s = map (\x -> case x of { ')' -> '('; '(' -> ')'; _ -> x; }) $ reverse s kaomoji s hat | null s = 0 | not (null hat) && head s == '*' = 1 + kaomoji (tail s) "^" | head s == '^' = kaomoji (tail s) "^" | otherwise = kaomoji (tail s) "" main = getLine >>= putStrLn . unwords . map show . tegami where tegami s = [kaomoji s "", kaomoji (hanten s) ""]