Count All Possible Unique Combinations of Letters in a Word You are given a string, which will contain ordinary a-z characters.  (You can assume this will always be the case in any test, and assume that all letters will be lowercase as well).  You must determine how many unique combinations can be made of the individual characters in the string, and print that number.  

However, duplicate letters can be ignored in counting the possible combinations.  In other words, if the string given is "hello", then simply switching the positions of the two ls does not count as a unique phrase, and therefore cannot be counted towards the total.

Shortest byte count wins, looking forward to seeing some creative solutions in non-golfing languages!

Examples:

hello -&gt; 60
aaaaa -&gt; 1
abcde -&gt; 120
Python 2, 50 48 bytes



f=lambda s:s==''or len(s)*f(s[1:])/s.count(s[0])


Try it online!

No boring built-ins! To my surprise, this is even shorter than the brute force approach, calculating all of the permutations with itertools and taking the length.

This function uses the formula

\$\text{# of unique permutations} = \frac{\text{(# of elements)!}}{\prod_{\text{unique elements}}{\text{(# of occurences of that element)!}}}\$

and computes it on the fly. The factorial in the numerator is calculated by multiplying by len(s) in each function call. The denominator is a bit more subtle; in each call, we divide by the number of occurences of that element in what's left of the string, ensuring that for every character c, all numbers between 1 and the amount of occurences of c (inclusive) will be divided by exactly once. Since we divide only at the very end, we're guaranteed not to have any problems with Python 2's default floor division.