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 __future__ import print_function # for PyPy2
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
from math import *

g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")

s = g()
stack = []

for ch in s:
	if ch == ")" and stack :#closing
		if stack[-1]=="(":
			stack.pop();stack.append(2)
		elif stack[-1] == ")":
			stack.append(ch)
		elif len(stack) > 1 :
			if stack[-2] == "(":
				v = stack.pop()
				stack.pop()
				stack.append(v+2)
			else:
				stack.append(ch)

		if len(stack) > 1 and type(stack[-1]) == int :
			while len(stack) > 1 and type(stack[-2]) == int:
				stack[-2] += stack[-1]
				stack.pop()
	else:
		stack.append(ch)

b = [-1]
for ch in stack:
	if type(ch) == str:
		b.append(0)
	else:
		for _ in range(ch):
			b.append(ch)


idx, val = 1, 0

for i in range(1, len(b)):
	if b[i] > val:
		val = b[i]
		idx = i

print(val, idx)

