Advertisement
nq1s788

24(2)

Dec 17th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. f = open('24.txt').readline() #ищем самую длинную последовательность LDRLDRLD...
  2. answ = 0 #самая длина длина которую мы нашли
  3. cur = 0 #текущая длина
  4. s = 'LDR'
  5. for i in range(len(f)):
  6. if f[i] == s[cur % 3]:
  7. cur += 1
  8. if cur > answ:
  9. answ = cur
  10. else:
  11. cur = 0
  12. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement