Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = open('24_23762.txt').readline()
- n = len(s)
- l = 0
- r = 0
- cnt_2025 = 0
- if s[0] == 'Y':
- cnt_y = 1
- else:
- cnt_y = 0
- answ = 0
- while r + 1 < n:
- r += 1
- if s[r] == 'Y':
- cnt_y += 1
- if r - l + 1 >= 4 and s[r - 3:r + 1] == '2025':
- cnt_2025 += 1
- if cnt_y > 80:
- while s[l] != 'Y':
- if r - l + 1 >= 4 and s[l:l + 4] == '2025':
- cnt_2025 -= 1
- l += 1
- l += 1
- cnt_y -= 1
- if cnt_y == 80 and cnt_2025 >= 90:
- answ = max(answ, r - l + 1)
- print(answ)
Advertisement
Add Comment
Please, Sign In to add comment