Assume that exactly Aβs stand on the last 4 positions (so ). It follows that there are Bβs on the last 4 positions and Aβs on the middle 4 positions. Also it follows that there are Cβs on the middle 4 positions and Cβs on the first 4 positions.
So there are ways to place Aβs on the last 4 positions. Then there are ways to place the rest Aβs on the middle 4 positions. Finally, there are ways to place Bβs on the first 4 positions. So if we place Aβs on the last 4 positions, Aβs on the middle 4 positions and Bβs on the first 4 positions, then the rest positions can be filled in the only way βCβs on the first and on the middle 4 positions, Bβs on the last 4 positions.
Hence the number of words with Aβs on the last 4 positions is equal to
and the total number is
Answer: 346