this is not calculus ... thread moved to Discrete Math
OR, are you treating as k distinct functions functions from the domain of all possible finite words in A into the non-negative integers?
I would guess the later, but I'm not sure.
With that assumption:
For the middle example: imagine there are 10 slots, numbered 1 through 10, that you need to fill with those letters to make your word. Choose 5 slots to fill with the A's, and then, from the 5 remaining slots, choose 2 to fill with the B's (Obviously the rest are then filled in with C's.) The number of ways to do that will be the number of distinguishable length 10 words using 5 A's, 2 B's and 3 C's.