Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('test.txt') as f:
- frst, snd, thrd, frth = str(), str(), str(), str()
- cnt = 0
- b = 0
- while a := f.read(1):
- frth = a
- if frst+snd+thrd+frth == 'XZZY':
- if cnt < b:
- cnt = b
- b = 0
- if frst+snd+thrd+frth == 'XZZY':
- b += 3
- if cnt < b:
- cnt = b
- else:
- b += 1
- if cnt < b:
- cnt = b
- frst, snd, thrd = snd, thrd, frth
- print(cnt)
Add Comment
Please, Sign In to add comment