Probability of Occurence of HEART or EARTH This is one of the questions I came across and I could only solve it partially. The question went 

A man is randomly typing on a keyboard. Then, what is the probability that the word HEART comes before EARTH?

My attempts

The first $4$ letters of EARTH are the same as last 4 of HEART. 

For EARTH to appear before HEART, any letter other than H must've appeared first and then should be followed by EART and then a H later on.

For HEART to appear first before EARTH, only the letter H must've appeared first and then may be followed by EART.

Since, the number of letters to appear in the case of HEART is less than EARTH, the probability of occurrence of HEART is more than that of EARTH.

To calculate how much, I'm just considering in case of

EARTH first: $$P(E)=\frac{25}{26}.\frac{1}{26}.\frac{1}{26}.\frac{1}{26}$$

HEART first: $$P(E)=\frac{1}{26}.\frac{25}{26}.\frac{25}{26}.\frac{25}{26}$$

This obviously isn't correct, since it doesn't give any individual probability for the occurrence of each letter.

So, can anyone calculate the probability for each of these two?
You can assume the key options are H, E, A, R, T, X, where "X" represents any other key that is not H, E, A, R, or T.  These are typed with probabilities $a, a, a, a, a, 1-5a$, respectively, for $0&lt; a\leq 1/5$. 

Next, you can model the situation with a finite state discrete time Markov chain.  For example, the initial state can be labeled START, there is a trapping state HEART, and another trapping state EARTH.  (A state $i$ is a "trapping state" if $P_{ii}=1$, that is, once reached, the probability of staying there is 1.) 

Can you define all states in the state space $S$, draw the chain, and label the transition probabilities?   

You then define $p(i)$ as the probability of eventually ending in HEART, given we start in state $i \in S$, and write recursive equations for $p(i)$.  Then the probability we eventually end in HEART is just $p(START)$. Note that $p(HEART) = 1$ and $p(EARTH)=0$.
First some notation - let $E(s)$ denote the expected number of letters that are typed before string $s$ is observed.

Now suppose that $E(HEART) &lt; E(EARTH)$. Letters are typed at random, so we can rename the letters without affecting probabilities. By renaming letters H to E, E to A etc. we can show that $E(EARTH) &lt; E(ARTHE)$. And by applying this argument several time we have

$E(HEART) &lt; E(EARTH) &lt; E(ARTHE) &lt; E(RTHEA) &lt; E(THEAR) &lt; E(HEART)$

which is a contradiction.

If we assume $E(HEART) &gt; E(EARTH)$ we can also derive a contradiction. So the only possible conclusion is $E(HEART) = E(EARTH)$ and so the probability that HEART is observed before EARTH is 0.5.

(This is essentially a symmetry argument).