Write a program that will read a line of text and output the number of words  in the line and the number of occurrences of each letter. 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. When outputting the number  of letters that occur in a line, be sure to count uppercase and lowercase versions of a  letter as the same letter. Output the letters in alphabetical order and list only those  letters that occur in the input line

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 14PE
icon
Related questions
Question

Write a program that will read a line of text and output the number of words 
in the line and the number of occurrences of each letter. 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. When outputting the number 
of letters that occur in a line, be sure to count uppercase and lowercase versions of a 
letter as the same letter. Output the letters in alphabetical order and list only those 
letters that occur in the input line. For example, the input line
 I say Hi.
 should produce output similar to the following:
 3 words
 1 a
 1 h
 2 i
 1 s
 1 y

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning