Balanced brackets: Difference between revisions

Line 2,964:
if x > 0 then b$ = left$(b$,x - 1) + mid$(b$,x + 2)
wend
if trim$(b$) = "" then print " OK """; else print "Not OK """;
print brk$(i);""""
next i</lang>
 
One output: <pre> OK ""
OK "[[[][]]]"
OK "[[[]][[[][[][]]]]]"
Not OK "][][]][["
OK "[][][]"
Not OK "[][]][]][[]]][[["
Not OK "]][[[[]]]][]]][[[["
OK "[[][[[]]][]]"
Not OK "[]][][][[[]]"
Not OK "][]][["
Not OK "[]][][][[]"
</pre>
 
Anonymous user