How Many 3 letter words from characters in "ABRACADABRA"? The words cannot have a repetition of letters and each character of the type is distinct i.e. the first 'B' is distinct from the second 'B', and both the 'B's can not be in a word simultaneously.
I need an algorithm/formula that answers for any word(provided as count of each letter).
for a smaller word: AABBC
answers are permutations of these letters:


*

*A1B1C

*A1B2C

*A2B1C

*A2B2C


These are all the combinations.
So count of all words is = 4 * 3P3 = 4 * 6 = 24

As an algorithm:
loop over (0-9) as A   
  loop over (0-9 excluding A) as B
    loop over(0-9 excluding B) as C
      output ABC
    end
  end
end

You could try asking this question on stackoverflow as well. 
