I've been struggling with this one for days now, and I really need some advice.
Assume I have a binary sequence. Say, something like this:
0 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1
Here, we can see a few sequences of consecutive ones. I want to zero out every second in each sequence. I.e, I'd like to get the following result:
0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1
If there is a way to do this by starting with zero instead, that would work too:
0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0
What is the shortest way of achieving this?
Regards,
Elias