TITLE: Letter permutations in 'COOLEEMEE'
QUESTION [7 upvotes]: I'm considering the word 'COOLEEMEE'. The first part is asking the number of distinguishable permutations of these 9 letters, which should be $9!/(2!4!)=7560$.
The next part is asking how many distinguishable permutations of these 9 letters are there if consecutive O’s are forbidden?
(And the last part if how many distinguishable permutations if consecutive E’s are forbidden)
If we don't allow consecutive O's, then I think we could first permute the rest letters 'CLEEMEE', so there're $7!/4!$ ways. Then there're 8 spaces and I want to insert 2 O's, so should that be $\frac{7!}{4!}\binom{8}2$ in total?
Then similarly if consecutive E’s are forbidden, there're $\frac{5!}{2!}\binom{6}4$ total ways. Is my reasoning correct? I feel like I missed some cases but I'm not sure. I've seen some similar examples which used the inclusion-exclusion principle, but I don't know if I need to use that here. Thanks:)

REPLY [2 votes]: Here we are looking for the number of words with no consecutive equal characters at all. Such words are called Smirnov or Carlitz words. See example III.24 Smirnov words in Analytic Combinatorics by Philippe Flajolet and Robert Sedgewick for more information.
A generating function for the number of Smirnov words over an $n$-ary alphabet is given by
\begin{align*}
\left(1-\frac{nz}{1+z}\right)^{-1}\tag{1}
\end{align*}

Here we consider an alphabet $\mathcal{V}=\{C,E,L,M,O\}$ with $n=5$ letters. Using $[z^k]$ to denote the coefficient of $z^k$ of a series we calculate
\begin{align*}
&\color{blue}{[CE^4LMO^2]\left(1-\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^{-1}}\tag{2}\\
&\qquad=[CE^4LMO^2]\sum_{j=0}^{\infty}\left(\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^j\tag{3}\\
&\qquad=[CE^4LMO^2]\sum_{j=5}^{9}\left(\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^j\tag{4}\\
&\qquad=[CE^4LMO^2]\sum_{j=5}^{9}\left(C+E\left(1-E+E^2-E^3\right)\right.\\
&\qquad\qquad\qquad\qquad\qquad\qquad\left.+L+M+O(1-O)\right)^j\tag{5}\\
&\qquad=120-1\,440+6\,300-11\,760+7\,560\tag{6}\\
&\,\,\color{blue}{\qquad=780}
\end{align*}
in accordance with @trueblueanils answer.

Comment:

In (2) we use the generating function (1). Since we want to identify specific powers of letters, we use a term $\frac{a}{1+a}$ for each letter in $\mathcal{V}$.

In (3) we expand the geometric series.

In (4) we observe that each term $\frac{a}{1+a}=a\left(1-a+a^2-\cdots\right)$ contains at least a factor $a$ so that the index range of of the series can be restricted to $j=5,\ldots,9$.

In (5) we expand $\frac{a}{1+a}$ for each of the letters in $\mathcal{V}$. We skip all powers of letters, which do not contribute to $C,E^4,L,M,O^2$.

In (6) we calculate the coefficients of the powers of $j=5,\ldots,9$ with some help of Wolfram Alpha.