Practice · 2 of 6
Final 2: The Chains
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** A necklace workshop throws bracket characters onto a bench in order. Find the length of the longest contiguous... no: longest **subsequence** (not necessarily contiguous) that forms a regular bracket sequence; print its length. **Constraints:** 1 ≤ |s| ≤ 200000; s contains only '(' and ')'. **Input:** one line: s. **Output:** one integer — the length.
Press Submit to check your solution.
Back to lesson: Practice: The Final Pack