Problem:
In how many ways can you rearrange the letters of "HMMTHMMT" such that the consecutive substring "HMMT" does not appear?
Problem:
In how many ways can you rearrange the letters of "HMMTHMMT" such that the consecutive substring "HMMT" does not appear?
Solution:
There are ways to order the letters. If the permuted letters contain "HMMT", there are ways to order the other letters, so we subtract these. However, we have subtracted "HMMTHMMT" twice, so we add it back once to obtain 361 possibilities.