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 -*-
"""
Created on Wed Apr 22 08:48:43 2020

@author: XaK
"""

string = input()
par_ab = 0
par_cer = 0
pare_reg = 0
cadena_sub = 0
reg_bol = False
for i in string:
    if(par_ab>0 and i ==")"):
        pare_reg+=1
        par_ab-=1
    if(i=="("):
        par_ab+=1
        reg_bol = True
    if(reg_bol==True and par_ab == 0 and par_cer == 0):
        cadena_sub+=1
        reg_bol = False
if(pare_reg !=0):
    print(pare_reg,cadena_sub)
else:
    print("0 1")
    