Advertisement
nq1s788

24 (никакие две соседние не совпадают)

Jan 24th, 2024
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. s = open("24.txt").readline()
  2. answ = 0
  3. cur = 0 #текущая длина
  4. lst = '!'
  5. for e in s:
  6.     if cur == 0 or e != lst:
  7.         cur += 1
  8.         lst = e
  9.         answ = max(answ, cur)
  10.     else:
  11.         cur = 1
  12.         lst = e
  13. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement