You are given n words made of lowercase English letters. Two words belong to the same anagram group if one can be rearranged into the other (they contain the same multiset of letters).
For each anagram group, its signature is the string obtained by sorting that group's letters in non-decreasing order (all words in a group share the same signature). Report every distinct group.
List the groups in ascending lexicographic order of their signature. For each group print its signature followed by a single space and the number of input words in that group.
Input format
Line 1: an integer n.
The next n lines each contain one word (lowercase English letters, no spaces).
Output format
Line 1: an integer g, the number of distinct anagram groups.
The next g lines: each line is signature count, where signature is the group's sorted-letter string and count is how many input words fall in that group. These g lines must be sorted in ascending lexicographic order of signature.
Constraints
- 1 ≤ n ≤ 2000
- 1 ≤ length of each word ≤ 50
- Every word consists only of lowercase English letters (
a–z). - Duplicate words may appear and each occurrence is counted.