Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('c8c8a1ca-a3d8-461f-b43b-3473a40a7d83.txt', 'r') as file:
- a = file.readline()
- cur_dist = 1
- max_dist = 1
- a_counter = 0
- last_pos = 0
- i = 0
- while i < len(a):
- if a[i] == 'A':
- a_counter += 1
- if a_counter == 0:
- cur_dist += 1
- elif a_counter == 1:
- cur_dist += 1
- last_pos += 1
- elif a_counter == 2:
- max_dist = max(max_dist, cur_dist)
- cur_dist = 1
- a_counter = 0
- i -= last_pos - 1
- last_pos = 0
- i += 1
- print(max_dist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement