# Comment by yjin

# This code cannot check order of parenthesis.
# for example : try this for input  (()))(() 
# Suggestion : you can break when unbalance < 0 in for-loop