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>.
s=input()
n=len(s)
l1=[-1]*n
l2=[-1]*n
l3=[0]*(n+1)
l=[]
for i in range(n):
    if s[i]=='(':
        l.append(i)
    else:
        if len(l):
            a=l[-1]
            l.pop()
            l1[i]=i
            if a!=0 :
                if l2[a-1]!=-1:
                    l2[i]=l2[a-1]
                else:
                    l2[i]=a
            else:
                l2[i]=0
            l3[l1[i]-l2[i]+1]+=1
ans1,ans2=0,1
for i in range(n,-1,-1):
    if l3[i]!=0:
        ans1=i
        ans2=l3[i]
        break
print(ans1,ans2)
            
