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 rl():
    return list(map(int,input().split()))
def ri():
    return int(input())
def rs():
    return input()
def rm():
    return map(int,input().split())

def main():
    a=rs()
    n=len(a)
    dp=[[-1,-1] for i in range(n)]
    if a[0]=='(':dp[0][0]=1 
    for i in range(1,n):
        if a[i-1]=='(': 
            if a[i]=='(':
                dp[i][0]=1
                dp[i][1]=-1
            else:
                dp[i][0]=-1
                dp[i][1]=dp[i-1][0]+1 if dp[i-1][0]!=-1 else -1
        if a[i-1]==')':
            if a[i]=='(':
                dp[i][0]=dp[i-1][1]+1 if dp[i-1][1]!=-1 else 1
                dp[i][1]=-1
            else:
                dp[i][0]=-1
                if i-1-dp[i-1][1]>-1 and a[i-1-dp[i-1][1]]=='(': dp[i][1]=dp[i-1][1]+dp[i-1-dp[i-1][1]][0]+1
                else: dp[i][1]=-1
    mx=0
    cnt=0
    for i in range(n): mx=max(dp[i][1],mx)
    for i in range(n): 
        if dp[i][1]==mx: cnt+=1
    if mx>0: print(mx,cnt)
    else:print(0,1)

main()