You might start with the idea that each letter is a different color; so you have 9 unique letter-color items to select for a permutation: For example, you swap an orange M with the green M and you have a different order of the elements.

So there are 9! ways to chose those 9 letters.

Now, if all of the letters are the same colorâ€“equivalently, weâ€™re going to ignore color nowâ€“changing the position of the two Mâ€™s is no longer a different combination. So how many â€śduplicatesâ€ť would there be? Well, consider the case when the letters were different colors and youâ€™ll see (after some thought) that youâ€™ll have 2! x 2! x 2! possible ways of selecting the order of the â€śduplicatesâ€ť for any given configuration where those letters would appear in a sequence. So we just divide these out from the total.