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>.
string=input()

n=len(string)
brackets=[]
bracket_sum=[]
bracket_len=[]
valid_brackets=[0]
invalid_index=[]
for char in string:
    bracket_sum.append(0)
    bracket_len.append(0)
        
    if char=='(':
        bracket_sum=[i+1 for i in bracket_sum]
    else:
        bracket_sum=[i-1 for i in bracket_sum]

    for j in range(len(bracket_sum)):
        if bracket_sum[j]<0 :
            if j not in invalid_index:
                invalid_index.append(j)
    for ind in invalid_index:
        bracket_sum[ind]=-1
    if 0 in bracket_sum :
        index=bracket_sum.index(0)
        valid_brackets.append(len(bracket_len)-index)
    if bracket_sum[0]<0 :
        brackets.extend(valid_brackets)
        bracket_sum=[]
        bracket_len=[]
        valid_brackets=[0]
        invalid_index=[]
try:
    brackets.extend(valid_brackets)
except:
    pass
m=max(brackets)
if m==0:
    print(0,1)
else:
    print(m,brackets.count(m))
            
            
        
    
