Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = open('').readline()
- l = 0
- r = 0
- if s[0] == 'X':
- cnt_x = 1
- else:
- cnt_x = 0
- answ = 1
- while r < len(s):
- if r + 1 < len(s) and (cnt_x < 3 or (cnt_x == 3 and s[r + 1] != 'X')):
- r += 1
- if s[r + 1] == 'X':
- cnt_x += 1
- answ = max(answ, r - l + 1)
- else:
- while s[l] != 'X':
- l += 1
- l += 1
- cnt_x -= 1
- print(answ)
Advertisement
Add Comment
Please, Sign In to add comment