S = input() n = len(S) l = 0 r = 0 for i in range(n): if S[i] == "(": ll = False v = 0 for j in range(i + 1, n): if S[j] == "*": ll = True elif ll and S[j] == "^": v += 1 elif v >= 2 and S[j] == ")": l += 1 S = S[::-1] for i in range(n): if S[i] == ")": ll = False v = 0 for j in range(i + 1, n): if S[j] == "*": ll = True elif ll and S[j] == "^": v += 1 elif v >= 2 and S[j] == "(": r += 1 print(l, r)