Skip to content

Instantly share code, notes, and snippets.

@hackerdem
Created December 19, 2016 04:40
Show Gist options
  • Save hackerdem/50731d28c3d1278479309a51681ad903 to your computer and use it in GitHub Desktop.
Save hackerdem/50731d28c3d1278479309a51681ad903 to your computer and use it in GitHub Desktop.
import sys,re
with open('C:/Users/erdem/Desktop/memories/newe.txt', 'r') as test_cases:
for test in test_cases:
if test in ['','\n']:pass
else:
v=re.search('([-;\w]+)', test).group(0)
vqq=';'.join(re.findall('([\d|\w]+-[\d|\w]+)', test))
st=''
if vqq==v and 'END' in v and 'BEGIN' in v:
a=[]
st=re.search('(BEGIN-)([\d])',v).group(2)
check=re.findall('(-[\d]+)',v)
while st!='END' and st not in a:
a.append(st)
st=re.search('({}-)((END)|[\d]+)'.format(st),v).group(2)
if st=='END' and len(a)==len(check):print('GOOD')
else:print('BAD')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment