import java.util.TreeMap;
import java.util.stream.Collectors;
import java.io.*;
import static java.util.stream.Collectors.*;
import java.util.Arrays;

public class AlternativeWordCountApp {

    public static void main(String[] args) {
        ((new BufferedReader(new InputStreamReader(System.in)))
            .lines()
            .flatMap(line -> Arrays.stream(line.split("[^a-zA-Z']+")))    
            .collect(groupingBy(String::toLowerCase, TreeMap::new, counting())))
        .forEach((word, count) -> System.out.printf("%s %d\n", word, count));
    }
}
@@ -142,16 +142,52 @@
 .Arrays;
+%0Aimport static java.util.function.*;
 %0A%0Apublic
@@ -402,16 +402,30 @@
 ine.
+toLowerCase().
 split(%22%5B
 %5Ea-z
@@ -424,15 +424,11 @@
 t(%22%5B
-%5E
 a-z
-A-Z
 '%5D+%22
@@ -471,27 +471,18 @@
 gBy(
-String::toLowerCase
+identity()
 , Tr

fix faulty logic in converting words to lower case