Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('24.txt')
- s = f.readline()
- f.close()
- n = len(s)
- i = 0
- k = 1
- mxk = 1
- idx = 0
- while i + 1 < n:
- i += 1
- if s[i] + s[i-1] == 'PP':
- if k > mxk:
- idx = i
- mxk = k
- k = 1
- else:
- k += 1
- print(mxk, idx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement