We can use the gambling interpretation given in Exercise 28 to find the ex- pected number of tosses required to reach pattern B when we start with pat- tern A. To be a meaningful problem, we assume that pattern A does not have pattern B as a subpattern. Let EA(T B ) be the expected time to reach pattern B starting with pattern A. We use our gambling scheme and assume that the first k coin tosses produced the pattern A. During this time, the gamblers made an amount AB. The total amount the gamblers will have made when the pattern B occurs is BB. Thus, the amount that the gamblers made after the pattern A has occurred is BB - AB. Again by the fair game argument, EA(T B ) = BB-AB.
For example, suppose that we start with pattern A = HT and are trying to get the pattern B = HTH. Then we saw in Exercise 28 that AB = 4 and BB = 10 so EA(T B ) = BB-AB= 6.
Verify that this gambling interpretation leads to the correct answer for all starting states in the examples that you worked in Exercise 28.