#K9836. Count Anagram Groups
Count Anagram Groups
Count Anagram Groups
You are given T test cases. For each test case, you are given an integer N representing the number of book titles, followed by N strings. Your task is to count the number of groups of anagrams among the book titles. Two titles are considered anagrams if their characters, when sorted in lexicographical order, are identical.
Note: If N = 0, output 0.
inputFormat
The input begins with a single integer T, the number of test cases. Each test case starts with an integer N indicating the number of book titles, followed by N strings on subsequent lines. The titles consist of lowercase letters only.
outputFormat
For each test case, output a single line containing one integer: the number of distinct anagram groups among the given titles.
## sample1
3
listen
silent
enlist
1
</p>