Add a check to handle input text with fewer than 25 words.

The final blog in the main program throws an error when the stack is empty.  To avoid this, add a check to the while loop for the size of the stack.  Stop the loop when the stack has 1 element remaining (the last element will be the count from the last iteration of the loop, not a word).