S = input() l = list(S) left_count = 0 right_count = 0 flg = 0 left_flg = 0 right_flg = 0 for i in range(len(l)): if l[i] == "(": left_flg = 0 right_flg = 0 for j in range(i + 1, len(l)): if l[j] == "*": if left_flg == 0: left_flg += 1 if right_flg == 2: right_flg += 1 elif l[j] == "^": if left_flg == 1 or left_flg == 2: left_flg += 1 if right_flg == 0 or right_flg == 1: right_flg += 1 elif l[j] == ")": if left_flg == 3: left_count += 1 if right_flg == 3: right_count += 1 print(right_count,left_count)