Problem: How many rearrangements of the letters of $HMMTHMMT$ do not contain the substring $HMMT$? (For instance, one such arrangement is $HMMHMTMT$.)
Solution: The answer is $361$. If $A$ is the set of all rearrangements that do not contain the substring $HMMT$, we deploy complementary counting by observing $|A| =
|\{ \text{All permutations of } HMMT\}| - |\{ \text{All permutations that do contain } HMMT \}|
$The former set on the RHS is just $\frac{8!}{2!2!4!} = 420$ (there are two $T