Advertisement
nq1s788

24(гл+гл+согл)

May 18th, 2024 (edited)
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=48472
  2. data = open('24.txt').readline()
  3. gl = 'AO'
  4. sogl = 'CDF'
  5. cnt = 0 #длина текущей строки
  6. mx = 0 #ответ -- максимальная длина среди найденных
  7. for x in data: #x -- текущая буква
  8.     if ((cnt % 3 == 0 or cnt % 3 == 1) and (x in gl)) or ((cnt % 3 == 2) and (x in sogl)):
  9.         cnt += 1
  10.         if (cnt // 3) > mx and cnt % 3 == 0:
  11.             mx = cnt // 3
  12.     else:
  13.         cnt = 0
  14. print(mx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement