400. Longest Well-Formed Parentheses
0
Hard
Given a string consisting of only '(' and ')', determine the length of the longest well-formed parentheses substring.
Input Format
Enter the number of test cases followed by the input string for each test case.
Output Format
Print the length of the longest well-formed parentheses substring for each test case.
Example
Input
2
(()
)()())
Output
2
4
Constraints
1<=T<=1000
1<=Length(S)<=1000
Loading...
View Submissions
Console