S = input() l, r, f = 0, 0, 1 for s in S[:-1]: if s == '(': f = 1 elif f: l += s=='^' r += s=='*' f = 0 print(l, r)