First, let's determine how many combinations there are without any restrictions. There are 4 letters, so we have 4 options to choose from for the first letter. For the second letter, there are only 3 options, for the third there are only 2 options, and finally for the last letter there is just 1 option. Therefore, we have:

options
Now we can subtract the number of combinations in which a is immediately followed by b.
Instead of having 4 options to choose from, we now only have 3:
ab, c, or d
So using the same logic as before, we have:

options
Now just subtract the 6 combinations that don't work from the total:
24 - 6 = 18
The answer is 18.