Advertisement
dxnge

26

Dec 7th, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. with open('24-174.txt') as f:
  2.     a = f.readlines()
  3.     cnt = 0
  4.     mx_ln = 0
  5.     for i in a:
  6.         for nd in range(len(i)-1):
  7.             strt = i[nd]
  8.             cnt_R = 0
  9.             posit = nd+1
  10.             cur_cnt = 1
  11.             while cnt_R < 30 and posit+1 < len(i) and strt != i[posit]:
  12.                 if i[posit] == 'R':
  13.                     cnt_R += 1
  14.                 cur_cnt += 1
  15.                 posit += 1
  16.             if i[nd] == i[posit] and cnt_R < 30 and cur_cnt >= 3:
  17.                 cnt += 1
  18.                 if mx_ln < cur_cnt:
  19.                     mx_ln = cur_cnt
  20. print(mx_ln, cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement