bit string question The question originally asked for four consecutive $1$s; this is the question that two of the answers address. It was later changed to ask for five consecutive $1$s.

How many bit strings of length $10$ contain either five consecutive $0$'s or five consecutive $1$'s?
Can someone please help with figuring out an approach? I'm not sure I have the correct answer. I got $296$.
 A: 6 types for five $0$'s:
XXXX100000
XXX100000X
XX100000XX
X100000XXX
100000XXXX
00000XXXXX

$5 \cdot 2^4 + 2^5 = 112$
7 types for four $1$'s:
XXXXX01111  !!! 1 repeat with (1) and 2 with (2)
XXXX01111X  !!! 2 repeats with (2)
XXX01111XX
XX01111XXX
X01111XXXX
01111XXXXX  !!! (1)
1111XXXXXX  !!! (2)

$6 \cdot 2^5 + 2^6 - 5 = 251$
They intersect in 8 obvious cases, so the answer is $112 + 251 - 8 = 355$
A: A string of at least five $0$s contains one more string of exactly five $0$s than it contains strings of exactly six $0$s. Thus we can count each such string exactly once by subtracting the number of strings of exactly six $0$s from the number of strings of exactly five $0$s, which yields $6\cdot2^5-5\cdot2^4$.
Applying the same approach to strings of at least four $1$s yields $7\cdot2^6-6\cdot2^5$, for a total of $7\cdot26-5\cdot2^4=368$. However, this double-counts strings that either contain two separate strings of at least four $1$s, or both a string of at least four $1$s and a string of at least five $0$s. There are $5$ of the former and $8$ of the latter, so the answer is $368-13=355$.
A: Computing $$y_i:=x_{i+1}-x_i \quad  {\rm mod}\ 2\qquad(1\leq i\leq9)$$  transforms any admissible string into a string of length $9$ containing a run of $4$ zeroes. Conversely: To any such string of length $9$ correspond exactly two admissible strings.
A string of length $9$ containing a run of $4$ zeroes begins with $0000$ or contains a unique substring of the form $10000$. There are $2^5$ strings of the first kind and $5\cdot 2^4$ strings of the second kind. The string $000010000$ belongs to both classes. It follows that there are $32+5\cdot 16-1=111$ strings of length $9$ containing a run of $4$ zeroes.
Therefore the number of admissible strings of length $10$ is $222$.
