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>.
s=input()
a,top=[False]*1000003,0#a用来标记匹配的括号的位置 top用来记录当前栈的高度
st=[0]#模拟的栈
for i in range(len(s)):
    if s[i]=='(':#入栈
        st.append(i)#位置入栈
        top+=1
    elif bool(top):#还有未匹配的左括号
        a[i]=a[st[top]]=True#当前位置、入栈位置匹配成功
        top-=1
        st.remove(st[-1])#末位出栈
ans=w=ans1=0
for i in range(len(s)):#记录连续为True的段
    if a[i]:
        w+=1
    else:
        ans=max(ans,w)
        w=0
ans=max(ans,w)
w=0
for i in range(len(s)):
    if a[i]:
        w+=1
    else:
        if w==ans:
            ans1+=1
        w=0
if w==ans:
    ans1+=1
if ans:
    print(ans1,ans)
else:
    print('0 1')