Problem B
Anagram Counting
An anagram is a reordering of the letters in a word of phrase. For example, you can rearrange the letters of terraced to get the word retraced. Rearranging them some more will give you the word cratered. You can even make dactrere and redatrec, which are both anagrams of terraced even if they are not legitimate English words.
Input
Input contains up to $200$ words, one per line. Each word consists of upper- and lower-case letters (a–z) and may have as many as $100$ characters. Input ends at end of file.
Output
For every input word, output the total number of unique anagrams that can be made from it. For the purpose of this problem, upper- and lower-case letters are considered distinct.
Sample Input 1 | Sample Output 1 |
---|---|
at ordeals abcdefghijklmnopqrstuvwxyz abcdefghijklmabcdefghijklm abcdABCDabcd |
2 5040 403291461126605635584000000 49229914688306352000000 29937600 |