Well, the letters CAB can appear in 6 positions...

CABxxxxx, xCABxxxx, xxCABxxx, xxxCABxx, xxxxCABx and xxxxxCAB

BED cannot appear in the last 2 positions, so there are only 4 positions that permit CAB and BED.

Of these, the remaining letters have 3! permutations each...

So there are 4*6 = 24 permutations allowing the combination CABED.