# how many different words of length n over set A = {c, d,e, f,g, a,h} with exactly k occurrences of the character c?

how many different words of length n over set A = {c, d,e, f,g, a,h} with exactly k occurrences of the character c ? and how can i be able to solve those kind of problems ?

Think of the potential word of length $$n$$, as $$n$$ empty slots. You want to fill $$k$$ of them with the letter $$c$$ and the rest $$n-k$$ slots with the other $$6$$ letters.
In how many ways can you choose which of the $$k$$ slots to fill with $$c$$? This is exactly $${n\choose k} = \frac{n!}{k!(n-k)!}$$.
After you place all the $$c$$'s, you need to decide what to put in each of the other $$n-k$$ remaining slots, and you have $$6$$ choices for each of them, so $$6^{n-k}$$ choices in total.
Thus, the total number of words is $${n\choose k} 6^{n-k}$$.