793. 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
Input the number of test cases
Input the string
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