module String = struct include String let fold_left f init str = let n = String.length str - 1 in let rec doit i acc = if i > n then acc else doit (i + 1) (f acc str.[i]) in doit 0 init end let () = let (l, r), _ = read_line () |> String.fold_left (fun ((l, r), p) c -> if c = '*' then (l, r), true else if not p then (l, r), false else if c = ')' then (l + 1, r), false else if c = '^' then (l, r + 1), false else assert false) ((0, 0), false) in Printf.printf "%d %d\n" l r