Idexcel interview question

write a program to find strings are anagrams, write some queries based on the group by.