from tqdm import tqdm 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_exist = False for i in tqdm(left_pos): 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 for elm in tmp: if count < 2: if elm == '^': count += 1 else: if elm == '*': res += 1 break return res print(solve('left'), solve('right'))