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)
pre=[0]*n 
if(s[0]=='('):
    pre[0]=1 
else:
    pre[0]=-1
for i in range(1,n):
    #print(i)
    if(s[i]=='('):
        pre[i]=pre[i-1]+1 
    else:
        pre[i]=pre[i-1] - 1 
st=[]
ax=dict()
cnt=0
maxm=0
#print(pre)
for i in range(n):
    #print(st)
    if(len(st)==0):
        if(i==0 and pre[i]>=0):
            st.append(pre[i])
        elif(i>0 and pre[i]>pre[i-1]):
            st.append(pre[i])
            try :
                ax[cnt]+=1 
            except KeyError:
                ax[cnt]=0 
                ax[cnt]+=1
            cnt=0 
            
    elif(len(st)>0 and pre[i]>st[-1]):
        st.append(pre[i]) 
        
    elif(len(st)>0 and pre[i]<=st[-1]):
        cnt+=2
        st.pop() 
    maxm=max(maxm,cnt) 
    
try :
    ax[cnt]+=1 
except KeyError:
    ax[cnt]=0 
    ax[cnt]+=1
if(maxm==0):
    print(0 , 1)
else:
    
    print(maxm , ax[maxm])