s = input() left_pos = [i for i, k in enumerate(s) if k == '('] def left_solve(): res = 0 for i in left_pos: tmp = s[i+1:] count = 0 for j, elm in enumerate(tmp): if count < 2: if elm == '^': count += 1 else: if elm == '*': res += tmp[j+1:].count(')') break return res def right_solve(): res = 0 for i in left_pos: tmp = s[i+1:] count = 0 for j, elm in enumerate(tmp): if count < 1: if elm == '*': count += 1 elif count < 2: if elm == '^': count += 1 else: if elm == '^': res += tmp[j+1:].count(')') break return res print(left_solve(), right_solve())