Question: Write a program that will read in a line of text and output the number of words and the number of letters in the line.

Write a program that will read in a line of text and output the number of words and the number of letters in the line. Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma, or the beginning or end of the line. You can assume that the input consists entirely of letters, whitespace, commas, and periods. For example, the input line "Now is the Winter of our discontent.' It should produce output as 7 words and 29 letters. II should produce output as 7 words and 29 letters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
