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>.
from sys import stdin,stdout
input = stdin.readline
from math import gcd,log2
from collections import Counter
from heapq import heapify,heappop,heappush
# from time import time
# from bisect import bisect, bisect_left

s = input()
count = []
ans = 0
A = {}
l1 = []
A[0] = [-1]
for i in range(len(s)):
    if s[i] == '(':
        ans += 1  
    else:
        ans -= 1        
    count.append(ans)
    if ans in A:
        A[ans].append(i)
    else:
        A[ans] = [i]  
    if s[i] == ')':
        p = A[ans]
 
        if len(p) >= 2:
            opp = p[-2]
            k2 = i-opp    
            if opp != -1:
                if s[opp] == ')':
                    k2 += l1[opp]         
            l1.append(k2) 
        else:
            l1.append(0)
    else:
        l1.append(0)  
c = Counter(l1)  
op1 = max(l1)      
print(op1,c[op1])                  



    
