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().strip()

A=[0]

for s in S:
    if s=="(":
        A.append(A[-1]+1)
    else:
        A.append(A[-1]-1)
     
def seg_function(x,y): # Segment treeで扱うfunction
    return min(x,y)

LAST=dict()

for i in range(len(A)):
    LAST[A[i]]=i

N=len(A)+5

seg_el=1<<(N.bit_length()) # Segment treeの台の要素数
SEG=[1<<30]*(2*seg_el) # 1-indexedなので、要素数2*seg_el.Segment treeの初期値で初期化

for i in range(len(A)): # Aを対応する箇所へupdate
    SEG[i+seg_el]=A[i]

for i in range(seg_el-1,0,-1): # 親の部分もupdate
    SEG[i]=seg_function(SEG[i*2],SEG[i*2+1])

def update(n,x,seg_el): # A[n]をxへ更新
    i=n+seg_el
    SEG[i]=x
    i>>=1 # 子ノードへ
    
    while i!=0:
        SEG[i]=seg_function(SEG[i*2],SEG[i*2+1])
        i>>=1
        
def getvalues(l,r): # 区間[l,r)に関するseg_functionを調べる
    L=l+seg_el
    R=r+seg_el
    ANS=1<<30

    while L<R:
        if L & 1:
            ANS=seg_function(ANS , SEG[L])
            L+=1

        if R & 1:
            R-=1
            ANS=seg_function(ANS , SEG[R])
        L>>=1
        R>>=1

    return ANS

def bisect_on_SEG(l,x):
    L=l+seg_el
    R=seg_el*2-1
    
    while L<R:
        if SEG[L]<x:
            break
        if L & 1:
            L+=1
        L>>=1
        R>>=1
 
    if SEG[L]>=x:
        return N
 
    while L<seg_el:
        if SEG[L*2]<x:
            L=L*2
        else:
            L=L*2+1
 
    return L-seg_el

ANS=0
ANSIND=1

for i in range(len(A)-1):
    x=getvalues(i,i+1)

    j=bisect_on_SEG(i+1,x)

    j=min(LAST[x],j-1)
        
    ans=j-i

    #print(i,ans)

    if ans!=0 and ANS==ans:
        ANSIND+=1

    elif ANS<ans:
        ANS=ans
        ANSIND=1

print(ANS,ANSIND)

    
