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()
st=[]
ct=0
ans=[]
for i in range(len(s)):
    if not st:
        if s[i]!=')':
            st.append([s[i],i])
            ct+=1
    else:
        if s[i]=='(':
            st.append([s[i],i])
            ct+=1
        else:
            if st[-1][0]=='(':
                ans.append([st[-1][-1],i])
                st.pop(-1)
                ct-=1
ans=sorted(ans)
anss=[]
i=0
while i<len(ans):
    app=ans[i]
    while i+1<len(ans) and ans[i+1][0]>=ans[i][0] and ans[i+1][1]<=ans[i][1]:
        i+=1
    
    anss.append(app)
    i+=1
#print(anss)
arr=[]
i=0
maxi=0
new=[]

while i<len(anss):
    start=anss[i][0]
    while i+1<len(anss) and anss[i][-1]+1 ==anss[i+1][0]:
        i+=1
    end=anss[i][-1]
    i+=1
    arr.append([start,end])
    maxi=max(maxi,end-start+1)
    new.append(end-start+1)
#print(arr)
if maxi==0:
    print(0,1)
else:
    print(maxi,new.count(maxi))