TITLE: Find the number of rearrangements of AABBBCCDDD where there are no two consecutive As or Bs
QUESTION [7 upvotes]: I tried using inclusion exclusion where set $A$ is all the rearrangements where two $A$s are consecutive and set $B$ where two $B$s are consecutive. However, I got $8400$ which is incorrect. I think it has to do with there being $3$ $B$s so I am somehow counting them wrong.
This was my process:
Total rearrangements of $AABBBCCDDD:$ ${10\choose 2,3,2,3} = 25200$
$\left|A\right| = {9\choose 1,3,2,3} = 5040$
$\left|B\right| = {9\choose 2,1,1,2,3} = 15120$
$\left|AB\right| = {8\choose 1,1,1,2,3} = 3360$
$A\cup B = 25200 -(5040+15120)+3360 = 8400$
Any help or guidance would be extremely appreciated.

REPLY [3 votes]: This answer is rather a supplement which could be used as crosscheck for manual calculations. We consider a $4$-ary alphabet built from letters $\mathcal{V}=\{A,B,C,D\}$. Words which do not have any consecutive equal letters are called Smirnov words. A generating function for Smirnov words is given as
\begin{align*}
\left(1-\frac{Az}{1+Az}-\frac{Bz}{1+Bz}-\frac{Cz}{1+Cz}-\frac{Dz}{1+Dz}\right)^{-1}\tag{1}
\end{align*}
The coefficient $[z^n]$ of $z^n$ in the series (1) gives the number of $4$-ary words of length $n$ which do not have any consecutive letters.

In the current example we are looking for words which do not have consecutive letters $A$ and $B$. Since we do not have any restriction on $C$ or $D$ we replace $C$ and $D$ with one or more occurrences giving
\begin{align*}
Cz\quad&\to\quad Cz+\left(Cz\right)^2+\left(Cz\right)^3+\cdots=\frac{Cz}{1+Cz}\\
Dz\quad&\to\quad Dz+\left(Dz\right)^2+\left(Dz\right)^3+\cdots=\frac{Dz}{1+Dz}\tag{2}\\
\end{align*}
With some help of Wolfram Alpha we calculate the answer from (1) and (2) as
\begin{align*}
[z^{10}&A^2B^3C^2D^3]\left(1-\frac{Az}{1+Az}-\frac{Bz}{1+Bz}
-\frac{\frac{Cz}{1+Cz}}{1+\frac{Cz}{1+Cz}}-\frac{\frac{Dz}{1+Dz}}{1+\frac{Dz}{1+Dz}}\right)^{-1}\\
&=\color{blue}{[z^{10}A^2B^3C^2D^3]\left(1-\frac{Az}{1+Az}-\frac{Bz}{1+Bz}
-Cz-Dz\right)^{-1}}\\
&\,\,\color{blue}{=9\,660}
\end{align*}

Note: Smirnow words can be found for instance in example III.24 in  Analytic Combinatorics by P. Flajolet and R. Sedgewick.