все работает, не могу понять, что ему не нравится
package com.javarush.task.task19.task1907;
import java.io.*;
/*
Считаем слово
*/
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String string = "";
String world = "world";
int counter = 0;
String fname = reader.readLine();
reader.close();
FileReader fr = new FileReader(fname);
while (fr.ready()){
int data = fr.read();
string += (char)data;
}
string = string.replaceAll("\\p{Punct}", " ");
String[] strings = string.split(" ");
for(int i =0; i<strings.length; i++){
if(strings[i].trim().equalsIgnoreCase(world)){
counter++;
}
}
System.out.println(counter);
fr.close();
}
}