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()
l=[]
count=0
cl=[]
for j in range(len(s)):
    if(s[j]=='('):
        l.append(1)
        if(s[j-1]==')'):
            cl.append(count)
            count=0
    elif(s[j]==')'):
        if(len(l)>0):
            z=l.pop()
            count+=2
        if(len(l)==0):
            cl.append(count)
            cl.append(-1)
            count=0
#print(cl)
z=cl.count(-1)
fl=[]
tot=0
neha=0
for t in cl:
    if(neha==z):
        fl.append(t)
    if(t!=-1):
        tot+=t
    else:
        neha+=1
        fl.append(tot)
        tot=0
#print(fl)
if(max(cl)==0):
    print(0,1)
else:
    flag=0
    q=0
    for g in range(1,len(cl)-1,3):
        if(cl[g-1]==0 and cl[g+1]==-1):
            q+=cl[g]
            #print(q)
        else:
            flag=-1
            break
    if(flag==-1):
        if(max(fl)>=q):
            print(max(fl),fl.count(max(fl)))
        else:
            print(q,1)
    else:
        print(q,1)