It was asked of me to count all ternary strings with size $n$, such that each element $\{a,b,c\}$ occurs at least once in the string. Exercise specific, it was when $n=5$, but I'm looking on building a recurrence relation now.
I approached the problem by counting with labeled distribution i.e. $\frac{n!}{n_1!n_2!n_3!}$, for all possible $n_k$'s in $n=5$, which are either with $2$ repetitions and $1$ single letter, or $3$ repetitions and $2$ single letters. So for $5$ elements, it's $3 \cdot \frac{5!}{3!} + 3 \cdot \frac{5!}{2!2!}$. I'm not sure if I'm correct, because I'm not sure if I'm taking all cases into consideration.
Another way I thought of would be counting all the strings with only $2$ elements and subtract them from the number of all strings which is $3^5$, for this case.
I'll now be looking into in how to build a recurrence relation, and check my previous solution. I haven't found the same question in this forum. Any insight is appreciated!
P.S. This was an exam question. I am now checking my answers.