I am trying to count the number of words in a file passed through a string. I am also displaying the string to make sure the output is correct and I am getting the exact contents of the file.
However, my word count method counts the last word of the previous line and the first word of the next line as one word.
Example: "Test word (newline) test words" outputs as "Test wordtest words"
Tried adding "\n" to my code and it displays correct output now but still counts it as before.
Any help would be appreciated.