This is a sample line with 8 words. This line has 10 words. Note the two consequtive spaces. Leading space may cause another false word counted in this thirteen word line. Same problems with trailing spaces. Eight words here. and here too. Did you remember to remove the trailing \n? Thirteen words in this line. Also,interpunction should be counted,as,a,word,separator!Eleven here!!! This text has eight non-empty lines and seventy eight words total.