S = input().strip() N = len(S) S = "0"+S A = [0]*(N+1) B = [0]*(N+1) for i in range(1,N+1): if S[i]=="^": A[i] = A[i-1]+1 B[i] = B[i-1] elif S[i]=="*": A[i] = A[i-1] B[i] = B[i-1]+1 else: A[i] = A[i-1] B[i] = B[i-1] ans1 = 0 ans2 = 0 for i in range(1,N-4+1): if S[i]=="(": for j in range(i+4,N+1): if S[j]==")": high = j low = i while high-low>1: mid = (high+low)//2 if A[mid]-A[i]>=2: high = mid else: low = mid if A[high]-A[i]>=2 and B[j]-B[high]>=1: ans1 += 1 high = j low = i while high-low>1: mid = (high+low)//2 if A[j]-A[mid]>=2: low = mid else: high = mid if A[j]-A[low]>=2 and B[low]-B[i]>=1: ans2 += 1 print(ans1,ans2)