Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l1 = [int(i) for i in input().split()]
- mnln = 0
- for i in range(len(l1)):
- if l1[i] == 1:
- ln1 = 0
- ln2 = 0
- t = False
- t1 = False
- y = i - 1
- while(y >= 0) and (l1[i] != 2):
- ln1 += 1
- if l1[y] == 2:
- t = True
- break
- y -= 1
- y = i + 1
- while (y < len(l1)) and (l1[i] != 2):
- ln2 += 1
- if l1[y] == 2:
- t1 = True
- break
- y += 1
- if t1:
- if not t or ln1 > ln2:
- ln1 = ln2
- mnln = max(ln1, mnln)
- print(mnln)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement