Implement wc

Implement the Unix command wc to count the number of words in a file.

No need to implement the opening of a file reference, assume that you have already been passed the text of a file:

Answer

Answers are hidden from search engines.
language=java unix strings algorithm coding