Solution (source code)

= Solution

\b[Repeated letters.] There are six positions, with two copies of each of two letters. Counting labeled arrangements and dividing by the <permutations> of each repeated pair gives
$$
\boxed{\frac{6!}{2!\,2!}=180.}
$$

\b[Single-occupancy cells.] For $N$ indistinguishable particles, specifying which $N$ of the $M$ distinct cells are occupied completely specifies a configuration. Thus
$$
\boxed{W_{\rm indist}=\binom MN=\frac{M!}{N!(M-N)!}.}
$$
For distinguishable particles, each chosen occupied set admits $N!$ assignments of particle labels:
$$
\boxed{W_{\rm dist}=\binom MN N!=\frac{M!}{(M-N)!}.}
$$
Equivalently, successively place labeled particles in $M,M-1,\ldots,M-N+1$ available cells. The single-occupancy constraint is essential: this is not unrestricted <stars and bars>. Both counts give one empty configuration at $N=0$; at $N=M$ they give one unlabeled occupation pattern and $M!$ labeled assignments.