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>.
# -*- coding: utf-8 -*-

string = input()
list_str = list(string)
largo=0
lar_max=0
sub_str=0
par_ab=0
is_sub_str = False
pos=0
print(list_str)
while(True):
    if(pos+1>=len(list_str)):
        break
    if(list_str[pos] == "(" and list_str[pos+1] == "("):
        if(is_sub_str):
            par_ab+=1
    elif(list_str[pos] == "(" and list_str[pos+1] == ")"):
        largo+=2
        list_str.pop(pos)
        list_str.pop(pos)
        if(pos-2>=-1):
            pos-=2
        elif(pos-2==-2):
            pos-=1
        if(not is_sub_str):
            sub_str+=1
            is_sub_str=True
        if(par_ab==0 and largo>lar_max):
            lar_max=largo
        elif(par_ab>0):
            par_ab-=1
    elif(list_str[pos] == ")" and list_str[pos+1] == "("):
        is_sub_str=False
        par_ab=0
        largo=0
    elif(list_str[pos] == ")" and list_str[pos+1] == ")"):
        is_sub_str=False
        par_ab=0
        largo=0
    pos+=1

if(lar_max!=0 and sub_str!=0):
    print(lar_max,sub_str)
else:
    print("0 1")