nq1s788

24 соседние различные

Mar 18th, 2026
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=27421
  2. s = open('24_demo (1).txt').readline()
  3. l = 0
  4. r = 0
  5. answ = 1
  6. while r < len(s):
  7.     if r + 1 < len(s) and s[r] != s[r + 1]:
  8.         r += 1
  9.         answ = max(answ, r - l + 1)
  10.     else:
  11.         r += 1
  12.         l = r
  13. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment