dxnge

44

Dec 4th, 2021 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. from itertools import product
  2. f = open('24-157.txt')
  3. frst = f.read(1)
  4. cnt, cur_cnt = 1, 1
  5. cmb = list(product('PQR', repeat=2))
  6. while scnd := f.read(1):
  7.     if tuple(frst+scnd) not in cmb:
  8.         cur_cnt += 1
  9.         if cur_cnt > cnt:
  10.             cnt = cur_cnt
  11.     else:
  12.         cur_cnt = 1
  13.     frst = scnd
  14. print(cnt)
  15.  
Add Comment
Please, Sign In to add comment