import re S = input() right = re.compile(r"\*.*\^.*\^") left = re.compile(r"\^.*\^.*\*") rc = 0 lc = 0 for i in range(len(S)): for j in range(i + 4, len(S)): if S[i] == '(' and S[j] == ')': if right.search(S[i + 1:j]): rc += 1 if left.search(S[i + 1:j]): lc += 1 print(lc, rc)