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


class BracketsRegularSubSeq:
    def __init__(self, line: str):
        self.count = 0
        self.max = 0
        self.i = 0
        self.__line = line
        self.__len = len(line)
        self.__last_sub_i = self.__len - 2

    @property
    def len(self):
        return self.__len

    @property
    def last_sub_i(self):
        return self.__last_sub_i

    @property
    def line(self):
        return self.__line

    def __bool__(self):
        return self.i == self.len

    def next_is_open(self):
        return (self.i < self.last_sub_i) and (self.line[self.i + 1] == '(')

    def is_open(self):
        return self.line[self.i] == '('


def check_sub_seq(result: BracketsRegularSubSeq):
    stack = [True, True]
    push, pop = stack.append, stack.pop
    cur_len = 0

    result.i += 2
    while not result:
        is_open = result.is_open()
        if is_open:
            if cur_len and stack and result.next_is_open():
                sub_is_regular, sub_len = check_sub_seq(result)
                if sub_is_regular:
                    cur_len += sub_len
                else:
                    if cur_len > result.max:
                        result.max = cur_len
                        result.count = 1
                    elif cur_len == result.max:
                        result.count += 1
                    return False, cur_len
            else:
                push(is_open)
        else:
            if stack:
                cur_len += 1
                pop()
                if not stack:
                    return True, cur_len
            else:
                result.i -= 1
                return True, cur_len
        result.i += 1

    result.max = cur_len
    return False, cur_len


def get_result(line):
    result = BracketsRegularSubSeq(line)

    stack = []
    max_len, count = 0, 0
    cur_seq_pairs_len = 0
    push, pop = stack.append, stack.pop

    while not result:
        is_open = result.is_open()
        if is_open:
            if result.next_is_open() and (
                        cur_seq_pairs_len or max_len
            ) and stack:
                is_regular, sub_len = check_sub_seq(result)
                if is_regular:
                    cur_seq_pairs_len += sub_len
                else:
                    max_len = max_len or cur_seq_pairs_len
                    if max_len > result.max:
                        return max_len, 1
                    elif max_len == result.max and max_len:
                        return max_len, result.count + count
                    else:
                        return result.max, result.count
            else:
                push(is_open)
        else:
            if not stack:
                if cur_seq_pairs_len:
                    if cur_seq_pairs_len > max_len:
                        max_len = cur_seq_pairs_len
                        count = 1
                    elif cur_seq_pairs_len == max_len:
                        count += 1
                    cur_seq_pairs_len = 0
            else:
                pop()
                cur_seq_pairs_len += 1
        result.i += 1

    if cur_seq_pairs_len:
        if cur_seq_pairs_len > max_len:
            max_len = cur_seq_pairs_len
            count = 1
        elif cur_seq_pairs_len == max_len:
            count += 1

    return (max_len or cur_seq_pairs_len), count


if __name__ == "__main__":
    line = next(sys.stdin).strip()
    max_len, count = get_result(line)[:2]
    print(f'{max_len*2} {count or 1}')
