import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read().rstrip().decode() dp = [0,0,0,0] l_complete = 0 for x in S: if x == '(': dp[0] += 1 elif x == '^': dp[2] += dp[1] dp[1] = dp[0] dp[0] = 0 elif x == '*': dp[3] += dp[2] dp[2] = 0 elif x == ')': l_complete += dp[3] dp = [0,0,0,0,0] r_complete = 0 for x in S: if x == '(': dp[0] += 1 elif x == '^': dp[3] += dp[2] dp[2] = dp[1] dp[1] = 0 elif x == '*': dp[1] += dp[0] dp[0] = 0 elif x == ')': r_complete += dp[3] print(l_complete, r_complete)