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>.
from sys import stdin

class A:

    def solve(self):
        users = set()
        byte_data = 0
        for line in stdin:
            if line.startswith("+"):
                users.add(line[1:])
            elif line.startswith("-"):
                users.remove(line[1:])
            else:
                data = line.split(":")
                data[1] = data[1][:-1]
                byte_data += len(data[1]) * len(users)

        print(byte_data)

class B:

    def solve(self):
        input_data = [line[:-1] for line in stdin]
        max_len = max([len(l) for l in input_data])
        left = True
        print("".join(["*" for i in range(max_len + 2)]))

        for line in input_data:
            length = len(line)
            space_left = max_len - length
            left_space = 0
            right_space = 0

            if space_left % 2 == 0:
                left_space = right_space = space_left // 2
            else:
                left_space = right_space = (space_left - 1) // 2
                if left:
                    right_space += 1
                else:
                    left_space += 1

                left = not left

            print("*{}{}{}*".format(
                "".join([" " for i in range(left_space)]),
                line,
                "".join([" " for i in range(right_space)])
            ))

        print("".join(["*" for i in range(max_len + 2)]))

class C:

    def solve(self):
        from queue import LifoQueue
        line = input()

        max_len = 0
        max_quantity = 0

        for i in range(len(line)):
            stack = LifoQueue(maxsize=len(line))
            for j in range(i, len(line)):
                if line[j] == "(":
                    stack.put_nowait("(")
                else:
                    if stack.empty():
                        break

                    top = stack.get_nowait()
                    if top != "(":
                        break

                if stack.empty() and j + 1 - i > max_len:
                    max_len = j + 1 - i
                    max_quantity = 1
                elif stack.empty() and j + 1 - i == max_len:
                    max_quantity += 1

        print("{} {}".format(max_len, max_quantity if max_len != 0 else 1))

C().solve()
