> 
> Compute the number of words made of $2n$ letters taken from the alphabet $\{a\_1, a\_2,\ldots,a\_n\}$ such that each letters occurs exactly twice and no two consecutive letters are equal.
> 
> 
> 

I started first of all thinking about the possibilities when we are not restricted by the fact that two consecutive letters are equal. Because we need to choose $2n$, and letters occur exactly twice, so that we can permute each letter pair $2!$ times, we will have something like this: $$\frac{2n!}{(2!)^n} = \frac{2n!}{2^n}$$
Now, I have to somehow exclude the possibilities when two consecutive letters are equal. I was stuck here, then I came across the answer to the problem (which I assume is the same problem), from [Putnam and Beyond](http://www-bcf.usc.edu/~lototsky/PiMuEp/PutnamAndBeyond-Andreescu.pdf), page 326 in the PDF, and 309 of the book. I see that he has used inclusion-exclusion principle, but I didn't quite get how the numbers were obtained. Any explanation of that answer, or another solution is highly welcomed.