1. You are given an array of Strings. 2. You have to write a function that groups all anagrams together. 3. For example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] 4. If two words are anagrams but the case is different, they should not be grouped together. For example, "ABC" should not be grouped with "CbA". 5. The order of your output does not matter. 6. main takes input a String array from the users. 7. This is a functional problem. 8. You have to complete the groupAnagrams function. It takes as input a String array. It return a list of list of strings of anagrams grouped together. 9. Don't change the code of main.
Input Format
First line takes input N, the length of the string array. Second line takes input N space separated strings representing the elements of the array. Input is handled for you.
Output Format
anagrams grouped together. Output is handled for you.
Constraints
N/A
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
6 eat tea tan ate nat bat
Output
ate eat tea nat tan bat