Advertisement
Korotkodul

dem22.n24

Jun 18th, 2023
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. f = open('24.txt')
  2. s = f.readline()
  3. f.close()
  4.  
  5. n = len(s)
  6. i = 0
  7. k = 1
  8. mxk = 1
  9. idx = 0
  10. while i + 1 < n:
  11.     i += 1
  12.     if s[i] + s[i-1] == 'PP':
  13.         if k > mxk:
  14.             idx = i
  15.             mxk = k
  16.             k = 1
  17.     else:
  18.         k += 1
  19. print(mxk, idx)
  20.    
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement