A bracket sequence is called regular, if parenthesis in the given expression is balanced. For example '()()', '(())' are the regular string but '((()' is not a regular parenthesis string. If no such substring exists, print "0 1" (without quotes).
The first line of input contains an integer ‘T’, which denotes the number of test cases. Then each test case follows. Each line of the test case contains a string having characters ‘(‘ or ‘)’ in it.
For each test case print, 2 space-separated integers representing the length of the longest substring with regular bracket sequence and the number of such substrings present in the input string.
Update the length of the longest regular bracket substring in the variable ‘length’ and store the count of such substring in variable ‘count’ passed as parameters in the given function.
1 <= T <= 5 1 <= N <= 10 ^ 4 Time Limit : 1 sec.
You don’t need to print anything, it has already been taken care of. Just implement the given function.