Permutation count of AABBC Given a string:
$AABBC=A^2B^2C^1$ 
I am trying to find the Total Permutations (this may be incorrect):
$\dfrac{5!}{2!\cdot2!}=30$
My question is how would I find the partial sums (perhaps the wrong choice in words) when added together would give an index such that:


*

*$AABBC=1$

*$ABABC=2$

*$CBABA=29$

*$CBBAA=30$   (30 might be the wrong number here but is suppose to be the last)
I have tried to draw out a tree structure to get an idea and thought with as the minimum:
$CAABB$
$4(\dfrac{4!}{2!\cdot2!})$ + 1
And:
$CABAB$
I would get something like:
$4(\dfrac{4!}{2!\cdot2!}) + 0 + 1(\dfrac{2!}{2!}) + 0 + 0$
But I am missing something here. How would I find the sums needed for $BACAB$ ?
More specifically I am trying to find the index of a word that is arbitrarily long in alphanumeric.
So the string may also be something like:
$AAAAABBBBDDEEFFFGGGGGHIIIIJJJJKLMOOOPZZZZZ$
 A: Here is one way to make an index, illustrated by using $BACAB$ as an example.
First, take the number of letters to the right of the $C$ and multiply by $6$. In this case we get $12$.
Now for each $B$ we take the number of $A$'s that are to the right of it, and we add that to our running total. In our case the first $B$ has two $A$'s to the right, while the second $B$ has none. That means we're up at $12 + 2 = 14$.
Lastly, add $1$ if the first non-$C$ letter is a $B$. In this case it is, so we add $1$ to get to $15$.
This gives you a unique number from $0$ to $29$ to each of the $30$ possible permutations. If you want it to go from $1$ to $30$, just add one, in this example we'd get $16$.
This indexing would not sort the list alphabetically. It would, for instance, put $BAABC$ in front of $ACBBA$. Then again, that is one way you could do it: Write the list of all permutations in alphabetical order, and just index them from there.
A: Take your letters, and distinguish same letters with subscripts, like $A_1 A_2 B_1 B_2 C$. That gives $2 + 2 + 1 = 5$ different symbols, that can be permuted in $5!$ ways. If you erase the subindices, this means e. g. $A_1 A_2$ are now the same, need to divide by $2! 2! 1!$, so the total is
$$
\frac{5!}{2! 2! 1!} = \binom{2 + 2 + 1}{2, 2, 1}
$$
This is a multinomial coefficient, the coefficient of $a^2 b^2 c$ in $(a + b + c)^5$
