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>.
import sys
from collections import deque, Counter, defaultdict
from string import ascii_lowercase as chars
inf = float("inf")


def input():
    return sys.stdin.readline().rstrip()


def read_ints():
    return map(int, input().split())


def main():
    # n = int(input())
    # a = list(read_ints())
    pass
    s = input()
    # )((())))(()())

    st = []
    cnt = defaultdict(int)
    cnt[0] = 1
    res = 0
    for i, ch in enumerate(s):
        if ch == ")":
            if st and s[st[-1]] == "(":
                res = max(res, i-st[-1]+1)
                cnt[i-st[-1]+1] += 1
                st.pop()
            else:
                continue
        else:
            st.append(i)
    print(res)
    print(cnt[res])


if __name__ == "__main__":
    # t = int(input())
    t = 1
    for _ in range(t):
        main()
