It says, that my program don't find all "świat" words, but I have no idea why it is like this. Any clue?
package pl.codegym.task.task19.task1907;
/*
Liczenie słów
*/
import java.io.*;
public class Solution {
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int count = 0;
try{
String input = reader.readLine();
reader.close();
FileReader fileReader = new FileReader(input);
StringBuilder x = new StringBuilder();
while (fileReader.ready()){
char y = (char) fileReader.read();
x.append(y);
}
fileReader.close();
x.toString().toLowerCase();
String[] tab = x.toString().split("\\W");
for (int y = 0; y < tab.length; y++){
if(tab[y].equals("świat") || tab[y].contains("świat")){
count ++;
}
}
System.out.println(count);
}catch (FileNotFoundException e){}
catch (IOException e){}
}
}