Advertisement
Korotkodul

N11

Jun 18th, 2023
977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. f = open('24.txt')
  2. s = f.readline()
  3. f.close()
  4.  
  5. def d(x,y):
  6.     global s
  7.     s = s.replace(x,y)
  8.  
  9. d('A', 'X')
  10. d('C', 'X')
  11. d('D', 'X')
  12. d('B', 'Y')
  13. d('E', 'Y')
  14. d('F', 'Y')
  15.  
  16. L = 1
  17. R = len(s)
  18. while L + 1 < R:
  19.     M = (L + R) // 2
  20.     if 'X' * M in s:
  21.         L = M
  22.     else:
  23.         R = M
  24. print(L)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement