Given a string S of opening and closing brackets '(' and ')' only. The task is to find an equal point. An equal point is an index such that the number of closing brackets on right from that point must be equal to number of opening brackets before that point.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an string S.
For each test case in a new line print the occurrence of the first equal point in the array.
1 <= T <= 100
1 <= S <= 106
Testcase 1: After index 4 (0-based indexing), number of closing on right from 4th index is 2 and closing before 4th is 2.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.