P1808 Word Classification
Description
Oliver decides to memorize English vocabulary, but he soon finds it hard to remember disordered words directly, so he decides to classify them.
Two words belong to the same class if and only if the counts of each letter in the two words are equal.
For example, $\verb!AABAC!$ and $\verb!CBAAA!$ can be grouped into the same class, whereas $\verb!AAABB!$ is not in the same class.
Now Oliver has $N$ words. All words consist of uppercase letters, and each word has a length of at most $100$. You need to tell Oliver how many classes these words are divided into.
Input Format
The first line contains the number of words $N$. Each of the next $N$ lines contains one word.
Output Format
Output a single integer, which is the number of classes into which these $N$ words are divided.
Explanation/Hint
- For $70\%$ of the testdata, $1 \le N \le 100$.
- For $100\%$ of the testdata, $1 \le N \le 10000$.
Translated by ChatGPT 5