Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l = input().split()
- cur_len_of_1 = 0
- prev_len_of_1 = 0
- ans = 0
- was_zero = 0
- for el in l:
- if el == '1':
- cur_len_of_1 += 1
- ans = max(ans, cur_len_of_1 + prev_len_of_1 + was_zero)
- if el == '0':
- prev_len_of_1 = cur_len_of_1
- cur_len_of_1 = 0
- was_zero = 1
- ans = max(ans, cur_len_of_1 + prev_len_of_1 + was_zero)
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement