Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s=''
- with open('f.txt') as f:
- s = f.readline()
- ans = 0
- fin = 0
- i = 0
- s = s.replace('R', 'Q')
- s = s.replace('S', 'Q')
- def f(l):
- global i
- while i + 1 < len(s):
- #print("i = ", i)
- if s[i] + s[i + 1] == 'QQ':
- #print("A")
- return l
- i += 1
- l += 1
- if i + 1 == len(s):
- #print("B")
- return l
- while i + 1 < len(s):
- #print("i = ", i)
- if s[i] + s[i + 1] == 'QQ':
- i += 1
- k = f(1)
- #print("k = ", k)
- if k > ans:
- ans = k
- fin = i
- i += 1
- print(ans)
- print(fin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement