Program that counts words, lines and characters

It checks the state whether the input is inside a word or not to
calculate the number of words present in the input.