Amazon Interview Question

DSA question: Print anagrams together.