import re def main(): S = input() bracketsL, bracketsR = [], [] s = S.find('(') e = len(S) - S[::-1].find(')') for i, t in enumerate(S[s:e]): if t == '(': bracketsL.append(i + s) elif t == ')': bracketsR.append(i + s + 1) regexl = re.compile(r'\^.*\^.*\*') regexr = re.compile(r'\*.*\^.*\^') left, right = 0, 0 for i in bracketsL: for j in bracketsR: if regexl.search(S[i:j]) is not None: left += 1 if regexr.search(S[i:j]) is not None: right += 1 print(left, right) main()