Assuming that the letters A, B and C are used to generate all possible "strings" of length seventeen (17) characters (like ACBBCABCACBCABCCB), how many of these strings have exactly four (4) B's? How can we go about this?
Context: I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
First pick the places for the $B$'s, which you can do in ${17 \choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.