103. Count Anagram Groups
MediumHash MapSorting
Print the number of groups when the words are grouped so that each group contains words that are anagrams of each other.
Input format
Line 1: n Line 2: n lowercase words
Output format
The number of groups.
Example 1
Input
6 eat tea tan ate nat bat
Output
3
Example 2
Input
1 a
Output
1
Constraints
1 ≤ n ≤ 10⁴
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…