Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- f = open('24.txt')
- s = f.readline()
- f.close()
- def d(x,y):
- global s
- s = s.replace(x,y)
- x = 'CDF'
- y = 'AO'
- print(s[:20])
- for i in x:
- d(i, 'X')
- print(s[:20])
- for i in y:
- d(i,'Y')
- print(s[:20])
- L = 1
- R = len(s)
- while L + 1 < R:
- M = (L + R) // 2
- if 'XY' * M in s:
- L = M
- else:
- R = M
- print(L)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement