This is yet another problem dealing with regular bracket sequences.

We should remind you that a bracket sequence is called regular, if by inserting «+» and «1» into it we can get a correct mathematical expression. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not. 

You are given a string of «(» and «)» characters. You are to find its longest substring that is a regular bracket sequence. You are to find the number of such substrings as well.
The first line of the input file contains a non-empty string, consisting of «(» and «)» characters. Its length does not exceed 10<sup class="upper-index">6</sup>.
E = [0]*(1000001)
S = [0]*(1000001)
f = [0]*(1000001)
s = input()
stack = []
n = len(s)
mx = 0
for i in range(n):
    if s[i] == '(':
        stack.append(i)
    else:
        if stack == []:
            S[i] = -1
            E[i] = -1
        else:
            j = stack.pop()
            S[i] = E[i] = j
            if (j>0 and s[j-1] == ')'and S[j-1]>=0):
                E[i] = E[j-1]
            l = i-E[i]+1
            f[l] = f[l]+1
            mx = max(mx,l)
f[0] = 1
print(mx,end=" ")
print(f[mx])
            