s = input() left_list = [] right_list = [] astr_list = [] hat_list = [] for i in range(len(s)): if s[i] == "(": left_list.append(i) elif s[i] == ")": right_list.append(i) elif s[i] == "*": astr_list.append(i) left_counter = 0 right_counter = 0 for i in left_list: right_for_i = [ j for j in right_list if j > i+2 ] for j in right_for_i: for k in range(i,j): if s[k] == "*": if s[k:j+1].count("^") >= 2: right_counter += 1 break for k in range(j,i,-1): if s[k] == "*": if s[i:k].count("^") >= 2: left_counter += 1 break print(left_counter,right_counter)