Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by Yeti
def sprilosc(dane):
a1=0
a2=0
b1=0
b2=0
c1=0
c2=0
for x in dane:
if x=='(':
a1+=1
elif x==')':
a2+=1
elif x=='[':
b1+=1
elif x==']':
b2+=1
elif x=='{':
c1+=1
elif x=='}':
c2+=1
if a1==a2 and b1==b2 and b1==b2:
return True
return False
def sprkolejnosc(dane):
lnaw=[]
dane=str(dane)
for x in dane:
if x=='(' or x=='[' or x=='{':
lnaw.append(x)
if x==')':
if lnaw:
if lnaw[-1]=='(':
lnaw.pop()
else:
return False
if x==']':
if lnaw:
if lnaw[-1]=='[':
lnaw.pop()
else:
return False
if x=='}':
if lnaw:
if lnaw[-1]=='{':
lnaw.pop()
else:
return False
if lnaw:
return False
else:
return True
def sprznaki(dane):
dane=str(dane)
x=0
while x
Nov. 4, 2016