I tried it with a real File and it is working, why is he not letting me pass?
package com.codegym.task.task19.task1907;
/*
Counting words
*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicInteger;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
BufferedReader br = new BufferedReader(new FileReader(bf.readLine()));
bf.close();
StringBuilder sb = new StringBuilder();
AtomicInteger worldCount = new AtomicInteger();
while (br.ready()){
sb.append(br.readLine());
}
String completeFile = new String(sb);
String removedPunctionalMarks = completeFile.replaceAll("[^a-zA-Z ]", " ");
String[] splitt = removedPunctionalMarks.split(" ");
Arrays.stream(splitt).forEach(s -> {
if(s.equals("world")){
worldCount.getAndIncrement();
}
});
System.out.println(worldCount);
br.close();
}
}