Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('24.txt').readline() #ищем самую длинную последовательность LDRLDRLD...
- answ = 0 #самая длина длина которую мы нашли
- cur = 0 #текущая длина
- s = 'LDR'
- for i in range(len(f)):
- if f[i] == s[cur % 3]:
- cur += 1
- if cur > answ:
- answ = cur
- else:
- cur = 0
- print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement