In how many ways can the letters $a, a, b, b, c, d, e$ be listed such that the letter $c$ and $d$ are not in consecutive positions?
My partial solution:
So, because we have $7$ letters, we will have $7!$ arrangements, but then we see that letters $a$ and $b$ have two copies, so we will have about $\frac{7!}{2!2!}$ arrangement, which according to my calculation is $1260$. But clearly, this number also counts all the arrangements where letters $c$ and $d$ are in consecutive order.
If I fix the letter $c$ in the first position, then I would have $5$ options for the second position, because I cannot have letter $d$ in the second position, and then $5!$ for the last five letters, so I will get $5*5!$. Same thing happens if I fix letter $d$ at the first position. But, then again they can be in other positions too. Plus, if letter $c$ is somewhere in the middle of the listing, then letter $d$ cannot be neither to its left nor to its right, which further limits the number of arrangements. I'm really stuck with it.