S = input() right, left = "* ^ ^".split()+[")"]*10000, "^ ^ *".split()+[")"]*10000 result_r, result_l = 0, 0 for i, c in enumerate(S): if c != "(": continue r_i, l_i = 0, 0 r_c, l_c = right[0], left[0] for c2 in S[i+1:]: if c2 == r_c: r_i += 1 r_c = right[r_i] if c2 == l_c: l_i += 1 l_c = left[l_i] result_r += max(0, r_i-3) result_l += max(0, l_i-3) print(result_l, result_r)