Loading...
Loading...
Loading...
A word game puts two words in the same group when one is a rearrangement of the other. Print the number of groups and the size of the largest group.
Example 1
Input
6 listen silent enlist google cat act
Output
3 3
Groups of three, one and two.
Example 2
Input
2 ab cd
Output
2 1
Try the problem first. Open one hint at a time.
Two words are in the same group when their sorted letters are equal.
Use the sorted letters as a dictionary key and count how many words share each key.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor