Agility Kata "Word Count III"

The application can be started with a file name to read out the text instead of entering it manually. If no file name is specified, the application asks for a text as before. Application example:

$ wordcount mytext.txt
Number of words: 4

The file mytext.txt looks as follows:

Mary had
a little
lambWith mytext.txt it looks like this:

Previous iteration edited?

You are currently opening an agility kata. Have you already worked on the previous part?

Please only open this exercise if you have already completed the previous parts. The idea of the Agility Katas is to implement additional requirements on existing code. If you look at all the requirements first, the effect of the Agility Katas will be lost.