Problems
Longest Valid Parentheses
Longest Valid Parentheses
Given a string containing just the characters '(' and ')'. Find the length of the longest valid (well-formed) parentheses substring.
Input
One string consisting of characters '(' and ')' of length no more than 106
.
Output
Print the length of the longest well-formed parentheses substring.
Input example #1
)()())
Output example #1
4