Advertisement
nq1s788

24 (LDRLDRLDRLD)

Jan 24th, 2024
404
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 #текущая длина
  4. a = 'LDR'
  5. for e in s:
  6.     if e == a[cur % 3]:
  7.         cur += 1
  8.         answ = max(answ, cur)
  9.     else:
  10.         if e == 'L':
  11.             cur = 1
  12.         else:
  13.             cur = 0
  14. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement