Created
November 1, 2016 22:25
-
-
Save j10sanders/18d58b2dd8c0a744ca2b49ac0913aa74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bb(n): | |
prevstring = "" | |
while n != prevstring: | |
prevstring = n | |
n = n.replace("()", "").replace("[]", "").replace("{}", "") | |
return "YES" if n == "" else "NO" | |
t = int(input().strip()) | |
for a0 in range(t): | |
s = input().strip() | |
print(bb(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment