Restriction 1: A precedes B
Restriction 2: C precedes D
Note: They can be either adjacent or not.
For example,
ABCD
ACBD
ACDB
CABD
CDAB
but
CBAD
ABDC
are not allowed and so on, as long as A comes before B and C comes before D.
Is there a generalized way to solve such problems?
Another similar problem to the above is finding the number of arrangements of ABCDE if
Restriction 1: A precedes B, B precedes C
Restriction 2: D precedes E
e.g.
ABCDE
ADBCE
DEABC
First we notice there are not restrictions on $B,D$ so we place them down. $$B,D$$ There are 2 ways to rearrange this.
Now we'll consider our first restriction for $A$ the only possible place we can add A is before B so now our list looks like this. $$A,B,D$$ There are still only 2 ways since $A$ has only one possible position.
Now we'll our second restriction. Notice how $C$ can be placed in 3 possible places: Between $BD,AB$ and before $A$. so we end up with $$A,B,C,D$$ which has $(2!)(1!)(3!)$ ways of rearranging.
In general you can go through this process for any permutation with restrictions as long as you start with the elements that have no restrictions on them.