s = input() left = "(^^*)" right = "(*^^)" ans = 0 i = 0 while i < len(s): if s[i] == '(': add = 0 while i < len(s) and s[i] == '(': i += 1 add += 1 state = 1 for j in range(i,len(s)): if state < len(left)-1 and s[j] == left[state]: state += 1 elif s[j] == left[state]: ans += add i += 1 print(ans,end=" ") ans = 0 i = 0 while i < len(s): if s[i] == '(': add = 0 while i < len(s) and s[i] == '(': i += 1 add += 1 state = 1 for j in range(i,len(s)): if state < len(right)-1 and s[j] == right[state]: state += 1 elif s[j] == right[state]: ans += add i += 1 print(ans)