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