Swap stores the number of swaps required imbalance maintains the number of imbalance pair
swap = 0 NEW_LINE imbalance = 0 ; NEW_LINE for i in range ( len ( chars ) ) : NEW_LINE INDENT if chars [ i ] == ' [ ' : NEW_LINE DEDENT