in C++ please For this problem you must create a program that accepts a line of English text as input. The string may contain spaces, so make sure you read the entire line of input. Next your program should count the occurrences of each letter of the English alphabet and determine which letter occurs most frequently in the string. Print this letter to the screen. If two letters tie for the most frequent count, break the tie by choosing the letter that occurs first in the alphabet. For example if the input string was "aabb", then your program should identify 'a' as the most frequently occurring letter. Finally, remove all occurrences of this most frequently occurring letter by replacing them with the '-' character, and print the final string to the screen. Sample Input aaaab Sample Output a ----b Simplifying Assumptions You may assume that all letters are lowercase You only need to count the letters of the alphabet (i.e. don't worry about counting special characters like punctuation, digits, etc.) If two letters tie for the most frequent count, break the tie by choosing the letter that occurs first in the alphabet.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question

in C++ please

For this problem you must create a program that accepts a line of English text as input. The string may contain spaces, so make sure you read the entire line of input. Next your program should count the occurrences of each letter of the English alphabet and determine which letter occurs most frequently in the string. Print this letter to the screen. If two letters tie for the most frequent count, break the tie by choosing the letter that occurs first in the alphabet. For example if the input string was "aabb", then your program should identify 'a' as the most frequently occurring letter.

Finally, remove all occurrences of this most frequently occurring letter by replacing them with the '-' character, and print the final string to the screen.

Sample Input

aaaab

Sample Output

a ----b

Simplifying Assumptions

  • You may assume that all letters are lowercase
  • You only need to count the letters of the alphabet (i.e. don't worry about counting special characters like punctuation, digits, etc.)
  • If two letters tie for the most frequent count, break the tie by choosing the letter that occurs first in the alphabet.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Datatypes
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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