Добрый день прошу глянуть что может быть не так
можно хотя бы текст как может вы гледеть
1213дзх123д,dlfsdf,wo
rld,lsdfksldf,world
Так может?
package com.javarush.task.task19.task1907;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Считаем слово
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader1 = new BufferedReader(new InputStreamReader(System.in));
String name1 = reader1.readLine();
reader1.close();
FileReader reader = new FileReader(name1);
String[] word={"123"};
String ord1="";
int count=0;
while (true) {
int x = reader.read();
if ( x==-1) {
if (ord1.equals("world\uFFFF")) count++;
break;
}
if (x == 119) {
ord1 = "w";
for (int i = 0; i < 5; i++) {
ord1 = (ord1 + (char) reader.read());
}
}
word = ord1.split("\\p{IsPunctuation}+"); // word = ord1.split("[\\p{IsPunctuation}\\p{IsWhite_Space}]+");
if (word[0].equals("world")) count++;
}
reader.close();
System.out.println(count);
}
}