A10. Farmer Alice has an alpaca, a cat, a dog, a gnu and a pig. She also has five fields in a row. She wants to put one animal in each field, but doesn't want to put two animals in adjacent fields if their names contain the same letter. In how many different ways can she place her animals?
Solution
4

The pig shares a letter with three other animals (alpaca, dog and gnu) and so it must have only one neighbour. This means that the pig must go at either end of the row and must be adjacent to the cat. The dog and gnu cannot be neighbours as they share the letter $\mathrm{g}$, which means that the alpaca must be placed between them. The dog or the gnu can be placed next to the cat. This means that there are two choices for where the pig is placed, and for each of these choices there are two choices for which animal is placed next to the cat, and so in total there are $2 \times 2=4$ different arrangements.