Loading...
Loading...
Loading...
Two words are anagrams if they use the same letters the same number of times. Given a list of words, print the number of groups of words that are anagrams of each other.
Example 1
Input
tea eat tan ate nat bat
Output
3
Example 2
Input
abc
Output
1
Try the problem first. Open one hint at a time.
Words in one group have the same sorted letters.
Use the sorted letters as a dictionary key or a set member.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor