In the second step 0000 will be 2 times of 00 - but in first step I want to find the longest possible stream.

(But thats the same problem again, just with a subset of the input data...)

You're right, that will bei the easiest method - but it also will be veeery inefficient.

If you find a repetition of 00 for example, in the next step you may increase your counter by 2...

I think, I'm not the first who have such or a similar problem, certainly some intelligent people thought long about that to find an efficient way....

But you'll not find any examples if you don't have a buzzword to search