Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use c++ and explain code please. Thanks Question 1: Write a program that will read in a line of text and output the number of
Use c++ and explain code please. Thanks
Question 1: Write a program that will read in 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 upper and lowercase versions of a letter as the same letter. Output the letters in alphabetical order and list only those letters that do occur in the input line. New Your program should interact with the user exactly as it shows in the following example: Please enter a line of text: I say Hi. words 1 1 h 2 i 1 s Notes: 1. Think how to break down your implementation to functions. 2. Pay attention to the running time of your program. If the input line contains n characters, an efficient implementation would run in a linear time (that is (n)). Question 2: Two strings are anagrams if the letters can be rearranged to form each other. For example, "Eleven plus two" is an anagram of "Twelve plus one". Each string contains one 'V', three 'e's, two 'l's, etc. Write a program that determines if two strings are anagrams. The program should not be case sensitive and should disregard any punctuation or spaces. Notes: 1. Think how to break down your implementation to functions. 2. Pay attention to the running time of your program. If each input string contains n characters, an efficient implementation would run in a linear time (that is (n))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started