CT27813

The scrolls Bracket Audit Puzzle

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Dante runs the stall at the lantern reef of Glowtide. Today the books show a list of scrolls, and the numbers must be worked out before sundown. Task: A string contains only '(' and ')'. Print YES if it is a balanced bracket sequence, otherwise NO. Input format: One line with a string of parentheses. Output format: Print YES or NO. Constraints: 1 <= |s| <= 1164; characters are '(' and ')'.

Example 1:

Input: )))))))()))))))()(()))))())(())))((()()((((()))()()())))(()())))())(((()()((())))())(()(()())()()(()(()(())))()))()))()))))())(())())()(()(()(()()()))()(((((()())()))))()))(((((()(()((((()))))))))))(((((((((())()))))))()(()))))))())((((())()()((()))())(((()())())())())(((())()())()()(()(()(()()(())()(())((())())))))(()))))()((()()()(()(()(()()))((()((())()()(((())()(())))()))(()))(())()(()(()))(()))()))()(((((((((((()))()))(((()()(((()(()(()(()((()(()())()())(()(())()))(())()())))(()()((()()
Output: NO

Example 2:

Input: ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Output: YES

Example 3:

Input: ((((((()))()(())((()((((()))(())))))())))))())(())))())(()(())((())))())(()))())())))(()(((()()))()(())(((()((()())())()(()))())(())))()(()()))(((()))())()()()()(((())()()()))())))))(()(((()(()))((((())())))(())(()))(())))()))()(()))()(()()))()()(()()(()(()))()())()))))())()))())((()))())(()(((()()((()((()(())()()()(((()))((()((((())(((((())((((()())))))()))(((((())))()((()((()()(()(((((((()))))())((()())(()))((()(
Output: NO

Constraints:

1 <= |s| <= 1164; characters are '(' and ')'.

Loading...
Test Cases:No test cases
No test cases available.
The scrolls Bracket Audit Puzzle - EASY Coding Problem | CodeTikki