<s>[INST] How many different strings of length $9$ containing only the letters a, b, and c have exactly two a's or exactly three b's? The question as stated in the title is how many different strings of length $9$ containing only the letters a, b, and c have exactly two a's or exactly three b's?
I came up with the idea that there is $C(9,2)$ ways to choose two a's and then the rest of the $7$ positions is $2^7$, and I added that to $C(9,3) \cdot 2^6$ with similar logic. However, I cannot seem to get the right numeric answer. Any help is appreciated.
 [/INST] This would be a good case for inclusion/exclusion.
Number of ways with exactly $2$ $A$ will $2^7*{9\choose 2}$. (This includes those with $0,1,2,3,4,5$ $B$s.... so this includes those with $2$ $A$ and $3$ $B$s).
Number of ways with exactly $3$ $B$s will be $2^6*{9\choose 3}$ (This includes those with $0,1,2,3,4$ $A$s.... so this includes those with $2$ $A$ and $3$ $B$s.).
And numbers of ways with exactly $2$ $A$s and $3$ $B$s would be $1^4*{9\choose 2}*{7\choose 3}$.  
So exactly $2$ $A$ or exactly $3$ $B$s will be: $2^7*{9\choose 2} + 2^6{9\choose 3}-1^4{9\choose 2}*{7\choose 3}$.
</s>