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 for i in bl: flagl = flagr = 0 for j in br: if flagl: left += 1 continue if flagr: left += 1 continue if i + 3 < j: l = re.search(r'\^.*\^.*\*', S[i:j+1]) if l is not None: left += 1 r = re.search(r'\*.*\^.*\^', S[i:j+1]) if r is not None: right += 1 flagl = flagr = 1 print(left, right) main()