2 questions about counting and permutation I have a test on monday and I couldn't solve these 2 questions, I'd be grateful if you help me
1-) How many ways are there to distribute 18 balls among 6 dierent persons if
a) each ball is dierent and each person should get 3 balls
b) all balls are identical ?
2-)How many permutations of the letters a a a b b b c c c d d d are there with no three consecutive letters the same?

Question 2:  We use the Principle of Inclusion/Exclusion. There are $\frac{12!}{3!3!3!3!}$ permutations (words). We now count the bad words, in which there are $3$ consecutive occurrences of a or of b or of c or of d. 
We count the words with $3$ consecutive a. Group the three a into a superletter, which we will call A. Then we have $10$ "letters," which we can arrange in $\frac{10!}{3!3!3!1!}$ ways. 
The same is true for $3$ consecutive b, c, or d. But if we add these $4$ numbers (or equivalently multiply the answer for aaa by $4$, the number $4\cdot \frac{10!}{3!3!3!1!}$ double-counts the words that have both aaa and bbb, and the same for all $\binom{4}{2}$ ways of choosing $2$ letters. By replacing aaa by the "letter" A, and bbb by B, we can see that there are $\frac{8!}{3!3!1!1!}$ words that have a a triple a or a triple b. So our new estimate of the number of bad words is
$4\cdot \frac{10!}{3!3!3!1!}-\binom{4}{2}\cdot \frac{8!}{3!3!1!1!}$.
However, we have subtracted too much, for we have subtracted once too many times the number of words that have three triple letters. Our new estimate of the number of bad words is $4\cdot \frac{10!}{3!3!3!1!}-\binom{4}{2}\cdot \frac{8!}{3!3!1!1!}+\binom{4}{3}\cdot \frac{6!}{3!1!1!1!}$.
However, we have added back once too often the bad words with all $4$ letters occurring in groups of $3$. So we need to subtract $\binom{4}{4}\cdot\frac{4!}{1!1!1!1!}$. 
Now put things together. The number of good words is
$$\binom{4}{0}\cdot \frac{12!}{3!3!3!3!}-\binom{4}{1}\cdot \frac{10!}{3!3!3!1!}+\binom{4}{2}\cdot \frac{8!}{3!3!1!1!}-\binom{4}{3}\cdot \frac{6!}{3!1!1!1!}+\binom{4}{4}\cdot\frac{4!}{1!1!1!1!}.$$
Remark: If $k_1+k_2+\cdots +k_t=n$, then $\frac{n!}{k_1!k_2!\cdots k_t!}$ is often denoted by the multinomial symbol $\binom{n}{k_1,k_2,\dots,k_t}$. That notation would make our formulas look better.
We do not wish to write out solutions for Question 1. But the answer to (a) will turn out to simplify to $\frac{18!}{3!3!3!3!3!3!}$. Part (b) is ambiguous, it is not clear whether we still want $3$ to each. But then the problem is trivial. If there is no restriction on the numbers given to each person, then a Stars and Bars argument gives the answer $\binom{23}{5}$. 
