public static void main(String[] args) {
String[] string = "you never know what you have until you clean your room".split(" ");
Map<Integer, List<String>> resultMap = Arrays.stream(string).distinct().collect(Collectors.groupingBy(String::length));
resultMap.forEach((k,v)-> {
System.out.printf("The words with lenth of %d %n", k);
v.forEach(System.out::println);
});
}