Determine why the program found more instances of the word "world " than exist in the file.
public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String fileName = reader.readLine();
        reader.close();
        FileReader fileReader = new FileReader(fileName);
        StringBuilder stringBuilder = new StringBuilder();
        while (fileReader.ready()) {
            stringBuilder.append((char) fileReader.read());
        }
        fileReader.close();
        String text = stringBuilder.toString().toLowerCase();
        boolean endsWithWorld = text.endsWith("world");
        System.out.println(text.split("world").length - (endsWithWorld ? 0 : 1));
    }
}