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 valid_parenthisis(s):
    if s=='':
        return False
    l=[]
    test=True
    for i in s:
        if i=="(":
            l.append(i)
        else:
            if l!=[]:
                l.pop()
            else:
                test=False

    if l!=[]:
        test=False

    return test



s=input()
l=[]
length=0
sub=1

for i in range(len(s)):
    for j in range(len(s)):
        if valid_parenthisis(s[i:j]):
            if length==len(s[i:j]):
                sub+=1
            length=max(length,len(s[i:j]))

print(length,sub)


