<jupyter_start><jupyter_text>2020년 5월 7일 목요일 BaekJoon - 9012번 : 괄호 문제 : https://www.acmicpc.net/problem/9012 블로그 : https://somjang.tistory.com/entry/BaekJoon-9012%EB%B2%88-%EA%B4%84%ED%98%B8-Python  첫번째 시도<jupyter_code>case = int(input())
result = []

for i in range(case):
    gwalhos = list(input())
    mystack = []
    double_break = True
    
    for j in range(len(gwalhos)):
        if gwalhos[j] == "(":
            mystack.append(gwalhos[j])
        else:
            try:
                if mystack.pop() == "(":
                    pass
            except:
                result.append("NO")
                double_break = False
                break

    if len(mystack):
        result.append("NO")
        continue
        
    if double_break:
        result.append("YES")
        
        
for i in result:
    print(i)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13048498845265588, 'fraction_numerical': 0.03117782909930716, 'mean_word_length': 1.7699680511182108, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '171912', 'license': 'MIT', 'n_tokens_mistral': 340, 'n_tokens_neox': 329, 'n_words': 53, 'path': 'DAY 001 ~ 100/DAY091_[BaekJoon] 괄호 (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '866'}