Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = open('').readline()
- d = 0
- answ = 0
- for i in range(len(s)):
- if (d != 0) and ((s[i - 1] == 'X' and s[i] == 'Y') or (s[i - 1] == 'Y' and s[i] == 'Z') or (s[i - 1] == 'Z' and s[i] == 'X')):
- d += 1
- answ = max(answ, d)
- elif s[i] == 'X':
- d = 1
- else:
- d = 0
- print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement