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>.
l="00"+input()+"00"
ans=[]
k=1
if "()" not in l:
    print("0 1")

else:
    i = l.index("()")
    j= l.index("()")+1
    while i<len(l) and j>k:
        if (l[i-1],l[j+1])==("(",")"):
            i-=1
            j+=1
        elif (l[i-2],l[i-1])==("(",")"):
            i-=2
        elif (l[j+1],l[j+2])==("(",")"):
            j+=2
        else:
            ans.append(j-i+1)
            k=j
            try:
                i = l.index("()",j)
                j = l.index("()",j) + 1
            except:
                break
print(str(max(ans))+" "+str(ans.count(max(ans))))