Let's say we have four elements A, B, C, and D.
How can I calculate number of all possible permutations (order matters) for set of 4, if repetitions are allowed, but it is required to have at least one B and one C element in each set?
How can I calculate similar task for same elements, same conditions, but for set of 5?
The total orderings are $4^4$, since each blank has $4$ choices. Now calculate the orderings which have no $B’s$ or no C’s:
$$n(\bar B \cup \bar C) = n(\bar B) + n(\bar C) - n(\bar B \cap \bar C) \\ =3^4 + 3^4 -2^4 \\ =146 $$
Hence, our desired answer is $4^4 -146 =110$
You can use a similar procedure for any number of blanks.