brcktsrm
Problem Description
Problem description. Vipul is a hardworking super-hero who maintains the bracket ratio of all the strings in the world. Recently he indulged himself in saving the string population so much that he lost his ability for checking brackets (luckily, not permanently ).Being his super-hero friend help him in his time of hardship.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single string S denoting the string to be checked.
Output
For each test case, output a single line printing "YES" or "NO" (without " " and in uppercase only) , denoting if the brackets in the given string is balanced or not .
Constraints
1 ≤ T ≤ 10 1 ≤ length of S ≤ 60
Example Input: 3 ((())) (())() ()(()
Output: YES YES NO
Explanation Example is self-explanatory.
Contest Information
- Contest ID: 0
- Problem Index:
- Points: 0.0
- Rating: 0
- Tags: None
- Time Limit: None seconds
- Memory Limit: 0 bytes
Task
Solve this competitive programming problem. Provide a complete solution that handles all the given constraints and edge cases.