Advertisement
nq1s788

24 (подстрока из одной буквы)

Jan 20th, 2024
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. s = open('24.txt').readline()
  2. answ = 0 #самая длинная которую мы нашли
  3. cur = 0 #длина текущей подстроки из Y
  4. for c in s:
  5.     if c == 'Y':
  6.         cur += 1
  7.         answ = max(answ, cur)
  8.     else:
  9.         cur = 0
  10. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement