How long would it take a monkey to type out "ABBA" from 26 capital letters? What is the expected time it would take a monkey typing out random letters (the 26 capital letters) to type out "ABBA"?
I have this modelled as a Markov Process, but I have no idea how to actually find the E.T. I have 26^4 as a rough approximation but I know this isn't the exact answer.
Any thoughts?
 A: Let $E_n$ for $0\leq n\leq 4$ be the expected number of additional keystrokes needed for the monkey to reach ABBA given that the last $n$ letters he has written corresponds to the first $n$ letters of ABBA. For instance, $E_4 = 0$, while $E_2$ is the expected number of keystrokes needed when the last two keys pressed were A and B, in that order.
If we are at the stage where the last two letters were AB, then there is a $\frac1{26}$ probability that the next letter will be B, and we have now gotten ABB. There is a $\frac1{26}$ probability that the next letter will be A, and then we will be back at A. Then we have a $\frac{24}{26}$ probability that it will be neither, and we're back where we started. Similarily for the other $E_n$s. This gives
$$
E_4 = 0\\
E_3 = \frac1{26}(1+E_4) + \frac{25}{26}(1+E_0)\\
E_2 = \frac1{26}(1+E_3) + \frac1{26}(1+E_1) + \frac{24}{26}(1+E_0)\\
E_1 = \frac1{26}(1+E_2) + \frac1{26}(1+E_1) + \frac{24}{26}(1+E_0)\\
E_0 = \frac1{26}(1+E_1) + \frac{25}{26}(1+E_0)
$$
Solving these five equations gives $E_0 = 456\,976 = 26^4$. So your rough approximation was actually correct.
