Advertisement
nq1s788

24 паттерн с остатками

Nov 13th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. s = open('').readline()
  2. d = 0
  3. answ = 0
  4. p = 'XYZ'
  5. for i in range(len(s)):
  6.     if s[i] == p[d % 3]:
  7.         d += 1
  8.         answ = max(answ, d)
  9.     else:
  10.         d = 0
  11. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement