For example, given: ["abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"] Return: ["abc","bcd","xyz"], ["az","ba"], ["acef"], ["a","z"]
public List<List<String>> groupStrings(String[] args){
List<List<String>> res = new ArrayList<>();
HashMap<String,List<String>> map = new HashMap<>();
for(String item : args){
String t = "";
for(char c : item){
t += (c+26-a[0])%26+",";
}
if(map.get(t)==null)
map.put(t,new ArrayList<Sring>());
map.put(t,map.get(t).add(item));
}
for(Entry<String,List<String>> entry : map.Entry()){
res.add(entry.getValue());
}
return res;
}