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>.
maxi = 0
cnt = 0
temp_len = 0
balance = 0
s = input()

for char in s:
    if char == '(':
        balance += 1
    else:
        balance -= 1
    
    if balance < 0:
        if maxi < temp_len:
            cnt = 1
            maxi = temp_len
        elif maxi == temp_len:
            cnt += 1
        temp_len = 0
        balance = 0
    else:
        temp_len += 1
if balance == 0:
    if maxi < temp_len:
        cnt = 1
        maxi = temp_len
    elif maxi == temp_len:
        cnt += 1   
if maxi == 0:
    if balance >= 0:
        maxi = temp_len - balance
    cnt = 1
    
print(maxi, cnt)
            