import re def main(): S = input() bl = [] br = [] apndl = bl.append apndr = br.append for i in range(len(S)): if S[i] == '(': apndl(i) elif S[i] == ')': apndr(i) left = 0 right = 0 pl = re.compile(r'\^.*\^.*\*') pr = re.compile(r'\*.*\^.*\^') for i in bl: flagl = flagr = 0 for j in br: if j - i < 4: continue if flagl: left += 1 else: l = pl.search(S[i:j+1]) if l is not None: left += 1 flagl = 1 if flagr: right += 1 else: r = pr.search(S[i:j+1]) if r is not None: right += 1 flagr = 1 print(left, right) main()