If there is only 1 character which does not balances then also it is Yes
elif ( po == 1 and ne == 0 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT elif ( po == 0 and ne == - 1 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT