Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Balanced-brackets/BASIC256/balanced-brackets.basic
Normal file
21
Task/Balanced-brackets/BASIC256/balanced-brackets.basic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
s$ = "[[]][]"
|
||||
print s$; " = ";
|
||||
|
||||
if not check_brackets(s$) then print "not ";
|
||||
print "ok"
|
||||
end
|
||||
|
||||
function check_brackets(s$)
|
||||
level = 0
|
||||
for i = 1 to length(s$)
|
||||
c$ = mid(s$, i, 1)
|
||||
begin case
|
||||
case c$ = "["
|
||||
level = level + 1
|
||||
case c$ = "]"
|
||||
level = level - 1
|
||||
if level < 0 then exit for
|
||||
end case
|
||||
next i
|
||||
return level = 0
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue