How many ways are there to arrange the letters A B C and D such that A is not followed immediately by B?

In order to continue enjoying our site, we ask that you confirm your identity as a human. Thank you very much for your cooperation.

$\begingroup$

Can someone explain this solution?

The question is:

How many ways are there to arrange the letters $a,b,c,d$ such that $a$ is not followed immediately by $b$?

The solution is:

$4! − 3! = 18$

I know that $4!$ comes from $4$ letters but where does $3!$ come from?

$\endgroup$

4