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>.
p = input()
cnta = 0
count = 0
max = 0
pp = 0
b = 0
for i in p:
    if i == "(":
        cnta += 1
    elif i == ")" and cnta > 0:
        cnta -= 1
        b = 1
    else:
        count -= 1
    count += 1
    if cnta == 0 and count > 0:
        if max < count:
            max = count
            pp = 1
        elif max == count:
            pp += 1
        count = 0
        b = 0
if cnta > 0:
    count -= cnta
    if max < count and b == 1:
        max = count
        pp = 1
    elif max == count and b == 1:
        pp += 1
        count = 0
    
if max == 0:
    print("0 1")
else:
    print(max,pp)
    
        
    