You are given a list of words words.
Put together the words that contain exactly the same letters, even if the letters are in a different order.
Return a list of these groups in any order.
Input: words = ["listen","silent","enlist","stone","tones","hello"]
Output: [["hello"], ["listen","silent","enlist"], ["stone","tones"]]
Explanation:
•"listen", "silent", and "enlist" share the same letters. • "stone" and "tones" share the same letters. • "hello" has no other match. _____________________________
Input: words = ["loop","pool","polo","top"]
Output: [["top"], ["loop","pool","polo"]]
Explanation:
•"loop", "pool", "polo" are anagrams of each other. •"top" stands alone.
Accepted:
Submission: