LearnPy Hub
← Arena
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
solution.py
Output appears here
Longest Balanced Part · Python Arena problem · LearnPy Hub