If answer is found , make level true so that valid of only that level are processed .
level = True NEW_LINE if ( level ) : NEW_LINE continue NEW_LINE for i in range ( len ( str ) ) : NEW_LINE if ( not isParenthesis ( str [ i ] ) ) : NEW_LINE INDENT continue NEW_LINE DEDENT