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>.
def left(a,l,r):
    n=r-l+1
    dp=[0 for i in range(n+1)]
    # print(l,r)
    open=0
    for i in range(r,l-1,-1):
        # print(a[i],end=" ")
        if a[i]==1:
            dp[r+1-i]=1+dp[r+1-i-1]
            if dp[r+1-i]>0:
                open+=1
            if dp[r+1-i]>=0:
                dp[r+1-i]=open
            # dp[r+1-i][1]=dp[r+1-i-1][1]+1
        else:
            dp[r+1-i]=min(-1,dp[r+1-i-1]-1)
            # dp[r+1-i][1]=-1+dp[r+1-i-1][1]
    # print()
    return dp

def right(a,l,r):
    n=r-l+1
    dp=[0 for i in range(n+1)]
    open=0
    for i in range(l,r+1):
        # print(i,a[i],end=" ")
        if a[i]==-1:
            dp[i-l+1]=1+dp[i-l+1-1]
            if dp[i-l+1]>0:
                open+=1
            if dp[i-l+1]>=0:
                dp[i-l+1]=open
            # dp[i-l+1][1]=dp[i-l+1-1][1]+1
        else:
            dp[i-l+1]=min(-1,dp[i-l+1-1]-1)
            # dp[i-l+1][1]=-1+dp[i-l+1-1][1]
    ans=[0 for i in range(n+1)]
    # print(dp)
    sm=0
    for i in range(1,n+1):
        sm+=a[l+i-1]
        if dp[i]>=0:
            ans[sm]=i
    return ans

def solve(a,l,r):
    n=r-l+1
    if n==1:
        return (0,1)
    mid=(l+r)//2
    lft=left(a,l,mid)
    rgt=right(a,mid+1,r)
    # print(l,r,lft,rgt)
    ans=0
    count=0
    sm=0
    for i in range(1,mid-l+2):
        sm+=a[l+i-1]
        # print(sm)
        if lft[i]>=0:
            # print("in",sm,rgt[sm],i)
            if ans<rgt[sm]+i:
                ans=rgt[sm]+i
                count=1
            elif ans==rgt[sm]+i:
                count+=1
    lft=0; rgt=0
    lft=solve(a,l,mid)
    if lft[0]>ans:
        ans=lft[0]
        count=lft[1]
    elif lft[0]==ans:
        count+=lft[1]
    rgt=solve(a,mid+1,r)
    if rgt[0]>ans:
        ans=rgt[0]
        count=rgt[1]
    elif rgt[0]==ans:
        count+=rgt[1]
    return (ans,count)
            
    

s=input()
s=[1 if i=='(' else -1 for i in s]
ans=solve(s,0,len(s)-1)
if ans[0]==0:
    print(0,1)
else:
    print(ans[0],ans[1])