package b_stream;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.stream.Stream;

class LongestWordInFile {

    public static void main(String[] args) throws IOException {
        Stream<String> lines = Files.lines(Paths.get("frankenstein.txt"));
        System.out.println(lines.flatMap(l -> Arrays.stream(l.split("[\\P{L}]+")))
                .max((lhs, rhs) -> Integer.compare(lhs.length(), rhs.length())).get());
    }
}

@@ -121,16 +121,48 @@
 Arrays;%0A
+import java.util.regex.Pattern;%0A
 import j
@@ -185,16 +185,16 @@
 Stream;%0A
-
 %0Aclass L
@@ -285,16 +285,83 @@
         
+Pattern wordSeparator = Pattern.compile(%22%5B%5C%5CP%7BL%7D%5D+%22);%0A%0A        try(
 Stream%3CS
@@ -421,18 +421,22 @@
 t%22))
-;%0A
+) %7B%0A  
         
 Syst
@@ -431,16 +431,18 @@
         
+  
 System.o
@@ -475,45 +475,44 @@
  -%3E 
-Arrays.stream(l.split(%22%5B%5C%5CP%7BL%7D%5D+%22)))%0A
+wordSeparator.splitAsStream(l))%0A    
     
@@ -595,16 +595,27 @@
 get());%0A
+        %7D%0A%0A
     %7D%0A%7D%0A

Work with files in close with resources. Extract pattern for better readablity.