Given a string S consisting only of opening and closing parenthesis 'ie '(' and ')', find out the length of the longest valid substring.
NOTE: Length of smallest the valid substring ( ) is 2.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow.
The first line of each test case contains a string S consisting only of ( and ).
Print out the length of the longest valid substring.
1 <= T <= 100
0 < S <= 110
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.