Problem C
Mischievous Children
Input: standard input
Output: standard output
Time Limit: 1 second
Memory Limit: 32 MB
Adam’s parents put up a sign that says “CONGRATULATIONS”. The sign is so big that exactly one letter fits on each panel. Some of Adam’s younger cousins got bored during the reception and decided to rearrange the panels. How many unique ways can the panels be arranged (counting the original arrangement)?
The first line of input is a single non-negative integer. It indicates the number of data sets to follow. Its value will be less than 30001.
Each data set consists of a single word, in all capital letters. For each word, output the number of unique ways that the letters can be rearranged (counting the original arrangement). Use the format shown in Sample Output, below.
Each word will have at most 20 letters. There will be no spaces or other punctuation.
The number of arrangements will always be able to fit into an unsigned long int. Note that 12! is the largest factorial that can fit into an unsigned long int.
3
HAPPY
WEDDING
ADAM
Data set 1: 60
Data set 2: 2520
Data set