I don't like over‑specified assignments, like the prohibition on buffered readers and split(). A buffered reader is a standard way to read files. Maybe prohibiting split() isn't quite as bad.
But, I think you are going the wrong way about the whole task. I think you have two tasks, one being to read the file, and the other being the counting. So divide the task up. Let's imagine you are doing the file reading first. Forget about getting the file name from the keyboard. Until you are reading your file correctly, do file reading and nothing else. Then consider the counting after that. Don't do any more counting until you have the file correctly read. I can see some pitfalls which can give you the wrong counts. But I am keeping quiet about them for the time being.
If you go through the Java™ Tutorials, you will find you are using legacy code. Don't create a File object. Do this:-That code still isn't right because you have to handle IOException or FileNotFoundException. This Java™ Tutorials part shows the correct way to handle such exceptions whilst also ensuring that the file is closed, which you are not doing at present.
Anything reading from or writing to a file must be closed after use; anything reading from or writing to System.in, System.out, or System.err should be left open for ever.
When you have got all that working reliably, then you should consider the next stage of the process.
What are you doing? You are supposed to be reading this tiny ad!
create, convert, edit or print DOC and DOCX in Java