Question: hi i need help with this problem in c++. thank you. 1. Write a program freq.cc which reads in a list of words and produce
1. Write a program freq.cc which reads in a list of words and produce two lists of output . The first list is the list of distinct words in the file as well as the number of times each word occursin the input. The words should first be converted to lower case (write a helper function to convert a character to its lower case equivalent and use transform in STL). This list should be sorted in "dictionary order based on the words. If the list of words is: abcd Computer science computer games The output should look like (the exact format is up to you) Word Frequency abcd computer games science The second list is the list of distinct words sorted in decreasing frequency Words with the same frequency should be listed in "dictionary order." For the list above the output should look like: Frequency Word 2 computer abcd 1 games 1 science You may assume that the words are separated by white space. The list is terminated by end-of-file Hint: You may wish to use a map to build the first list, and a vector of pairs to build the second list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
