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>.
# Submitted using https://github.com/Nirlep5252/codeforces-cli
# >.<

s = input()

d = 0
l = 0
count = 0
max_l = 0

for ch in s:
    if ch == '(':  # )
        d += 1
        l += 1
    else:
        if d > 0:
            d -= 1
            l += 1
        else:
            if l > max_l:
                max_l = l
                count = 1
            elif l == max_l:
                count += 1
            l = 0
    # print(d, l, count, max_l)

if l and d == 0:
    if l == max_l:
        count += 1
    elif l > max_l:
        max_l = l
        count = 1
    l = 0

if max_l == 0:
    print(0, 1)
else:
    print(max_l, count)

