Arrange friends We have for friends (A, B, C, and D) and we have 10 single rooms (1, 2, 3, 4, 5, 6, 7, 8, 9, 10). The rooms are ordered in a row.

*

*A and B always want to be in rooms that are neighbors

*C and D always want to be in rooms that are neighbors

*A and C always DO NOT want to be in rooms that are neighbors

How many ways there are to order the friends in the rooms?
I started to list all possible combinations in my opinion and I manage to list 196, so I am not sure if 196 is the right answer
However, mathematically I cannot get 196.
I am trying to calculate all the combinations to order 4 people in 10 rooms by this formula:
$n = 10$,
$k = 4$
$\binom{n}k$ = $\dfrac{n!}{k!(n - k)!}$
Therefore
$\binom{10}4 = \dfrac{10!}{4!(10 - 4)!} = \dfrac{10 * 9 * 8 * 7 * 6!}{4! * 6!} = \dfrac{5040}{24} = 210$
However, these are all combinations without considering the requirements 1 from 3. I tried to calculate 1 to 3 and after that extract this number from 210 to get smaller numbers, but I do not know how to consider these orderings.
Any help is really appreciated.
 A: Trying to start with subtracting cases from 210 is probably not a good idea here. (in fact, you would need to be subtracting cases from $210 \cdot 24=5040$ in order to account for the ordering of A/B/C/D in those $4$ rooms) The best way by far to do this is to find the answer only assuming conditions 1 and 2, then subtract the cases that go against condition 3. Let us call the two neighboring rooms A and B want to be in together E, and the two for C and D, F. Now note the following process:

*

*start with a row of 8 rooms

*choose one of these rooms to be E, and the other to be F.

*choose the ordering of A/B or B/A for E, and the ordering of C/D and D/C for F.
This finds every combination that obeys rules 1 and 2. Note that ignoring rule 3 the answer would therefore be $8 \cdot 7 \cdot 2 \cdot 2 = 224$. In order to account for rule 3, we need to check all cases where E and F are next to each other, and subtract one for when we permute A/B and C/D such that A and C end up next to each other. The number of ways for E and F to end up next to each other is clearly $7 \cdot 2=14$, so we would subtract this from $224$ to end up with $210$.

Note: this is equal to $\binom{10}{4}$, but I'm pretty sure that's a coincidence.
A: You can solve this using stars and bars.
We first line up $A, B, C$ and $D$ in a row. Now as $A$ and $B$ must be neighbors, and $C$ and $D$ must be neighbors, We can assign them room numbers such that there can be some rooms to their left , some between $\{AB\}$ and $\{CD\}$ and some to their right. As there are $6$ rooms left, we are looking for non-negative solutions to,
$x_1 + x_2 + x_3 = 6$
That is $ \displaystyle {6 + 3 - 1 \choose 3 -1 } = 28$
Now $A$ and $B$ can swap their places and still remain neighbors and so can $C$ and $D$. We can also swap the groups $\{AB\}$ and $\{CD\}$.
So number of solutions, given the first two conditions, is $~28 \cdot 8 = 224$
Now to take into account the third condition, we need to subtract those assignments of rooms where $A$ and $C$ were neighbors too. That can only happen if they are all assigned adjacent rooms and that leaves us to assign them rooms such that in total there are $6$ rooms in total to their left and right and none between them. There are obviously $7$ solutions as there can be $0 - 6$ rooms to the left and remaining to the right.
Now $A$ and $C$ can be neighbors in two ways - $~BACD~$ or $~DCAB$.
That leads to the final answer as $224 - 2 \cdot 7 = 210$.
A: There are $8$ possible ordered combos of two from  $ABCD$ meeting the first two conditions, eg (AB)(CD), (AB)(DC) etc, of which $2$, need a mythical $X$ to meet all $3$ conditions,
$(BAX)(CD), (DCX)(AB)$ with $6,5$ rooms left available for the two types
The two "blocks" can be placed anywhere in the total of $8,7$ points available, thus $6\binom82 + 2\binom72 = 210$ ways
