A monkey types at a 26-letter keyboard with one key corresponding to each of the lower-case English letters. Each keystroke is chosen independently and uniformly at random from the 26 possibilities. If the monkey types 1 million letters, what is the expected number of times the sequence "bonbon" appears?
P.S bonbonbon counts as two appearances.
My approach is
Let the indicator $I_B$ be the event that "bonbon" appears, then $P(I_B) = 1/26^6$
Then $E(X) = E(I_{B_1} + I_{B_2} + \dotsb + I_{B_\text{1 million}}) = 1\text{ million} \times 1/26^6$
Is my approach right? Somehow I feel I have done something wrong here.
Best Answer
If
xxbonbonbonbonxx
counts for three, the answer is correct provided one replaces one million by one million minus five. Why minus five? Because the wordbonbon
has length six hence it cannot begin at position 999,996 or later on and be completely written at position 1,000,000.