There is a fairly systematic way to work this type of question. You were specifically wondering about:
How many 4-letter words can be formed from the letters: ABBCCC?
First, you write the 'source partition' for your word:
[C,B,A]
[3,2,1] <-- this is the `source partition`
Note that the source partition provides for 1 triple, 1 double, and 1 single. Corresponding to that, you write every possible 'target partition' of 4-letters.
[3,1] requests one triple and 1 single
[2,2] requests 2 doubles
[2,1,1] requests one double and 2 singles
For each 'target partition', you write an expression that gives the number of ways that the given target type can occur. An example of the target type [3,1] is:
CCBC # type [3,1]
The expression for that type is:
nCr(1,1)*nCr(2,1) * fac(4)/fac(3)
'nCr( n, r)' is the function for 'combinations', which gives the number of ways you can make a unique selection from n distinct things, taking r at a time. 'fac( n)' is the function for the factorial of n.
Note that source [3,2,1] provides 1 triple, and target [3,1] requests 1 triple. Hence nCr(1,1)
. After the triple is used up, the source [3,2,1] can provide 2 singles, and the target [3,1] requests 1 single. Hence nCr(2,1)
The call to fac(4)
, in each expression, always corresponds to the 4-letter word. Any division, if it occurs in an expression, corresponds to each multiple request of the corresponding target partition. That's all there is to the method, but it isn't always easy to get every last detail correct. The entire computation, as I did it in the programming language Python, follows:
# The `source partition` for the word 'ABBCCC' is:
# [3,2,1]
# # target
w = 0 # ------
w += nCr(1,1)*nCr(2,1) * fac(4)/fac(3) # [3,1]
w += nCr(2,2) * fac(4)/(fac(2)*fac(2)) # [2,2]
w += nCr(2,1)*nCr(2,2) * fac(4)/fac(2) # [2,1,1]
#
# The answer is 38
If we have exactly one repetition is allowed, we start by choosing our three letters: $\binom{26}{3}$. We then choose a letter to be repeated in $\binom{3}{1} = 3$ ways. Finally, we permute our letters in $4!/2!$ ways by the multinomial distribution. By rule of product, we multiply, to get:
$$\binom{26}{3} \cdot 3 \cdot 4!/2!$$
Or add the four letter words with no repetitions (26*25*24*23) plus the ones with one repetition.
This is correct thinking. Notice that the words with no repetition are disjoint from words with exactly one repetition. So by rule of sum, you add $26!/(26-4)!$ with the quantity I noted above.
Best Answer
Let's do it smaller with $PPE$. If the letters $P$ are given an index then there are $3!=6$ possibilities:
If the indices are taken away then $P_1P_2E$ and $P_2P_2E$ both become $PPE$. It appears that possibility $PPE$ has been counted $2!=2$ times. To repair this we must divide by $2!$ and get $3$ as answer. This agrees with the fact that there are $3$ possibilities:
Likewise in $PEPPER$ every permutation is originally counted $3!2!$ times, so we must divide $6!$ by $3!2!$ to repair.