AdvancedRating 1800
Longest Balanced Part
Print the length of the longest balanced (well-formed) substring of brackets.
Input
One string of ( and ).
Output
A length.
Sample 1
Input
(()
Output
2
Sample 2
Input
)()())
Output
4
Output appears hereOne string of ( and ).
A length.
(()
2
)()())
4
Output appears here