s = input() left_pos = [i for i, k in enumerate(s) if k == '('] right_pos = [i for i, k in enumerate(s) if k == ')'] def solve(LorR): res = 0 is_first = None for i in left_pos: if is_first is not None and i < is_first: res += 1; continue is_exist = False for j in right_pos: if j < i: continue if is_exist: res += 1; continue if LorR == 'left': # 左向き tmp = s[i+1:j] else: # 右向き tmp = s[i+1:j][::-1] count = 0 is_first = None for index, elm in enumerate(tmp): if count < 2: if elm == '^': if is_first is None: is_first = index count += 1 else: if elm == '*': res += 1 is_exist = True break return res print(solve('left'), solve('right'))