Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A = list(map(int, input().split()))
- s = True
- res = 0
- while s:
- k = False
- c = 0
- for i in range(1, len(A)):
- if A[i] == A[i - 1] and i != len(A) - 1:
- c += 1
- elif i == len(A) - 1 and A[i] == A[i - 1] and c >= 1:
- c += 1
- for j in range(c + 1):
- A.pop(i - c - 1)
- res += c + 1
- k = True
- break
- elif c >= 2:
- for j in range(c + 1):
- A.pop(i - c - 1)
- res += c + 1
- k = True
- break
- else: c = 0
- s = k
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement