Proper initialization of the state variable, to
avoid improper detection of new word when first
input character is a white space character.
Fixed new line at EOF.