General approach to solve some counting problems

104 Views Asked by At

I have heard that there is a general approach using generating functions to solve the following type of problems: find the number of words of length $8$ made from letters $A, B, C, D, E$ such that letters $A$ and $B$ appear at most once and $C, D$ at least once.

Could anyone explain the approach or give a reference to book or source to read about it?