Group Anagrams
MediumGiven a list of lowercase words, group words that are anagrams of each other.
Input format:
- First line: n
- Next n lines: one word per line
Sort words inside each group alphabetically. Sort groups by their first word. Print one group per line with words separated by spaces.
Constraints
1 <= n <= 10^4 1 <= word length <= 100 Words contain lowercase English letters.