Keys and parenthesis P96529


Statement
 

pdf   zip

thehtml

Write a program that reads a sequence of words with curly brackets and parentheses, and for each one prints if the curly brackets and the parentheses close correctly.

Input

Input is a sequence of words consisting of |’[’|, |’]’|, |’(’| and |’)’|.

Output

For each word, print “yes” or “no” depending on if the curly brackets and the parentheses close correctly or not.

Public test cases
  • Input

    []([]())
    (([])()
    [](
    (([]))
    

    Output

    yes
    no
    no
    yes
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python