这是一个C++单词计算程序代写
Counting words
In this assignment, you will write a program wfreq.cpp that counts the occurrences of words
in a text given on standard input, and prints on output each word encountered in the input with
the number of times it appears. Each word must appear followed by its count on a single line.
Words and their count should appear in output in order of decreasing count. Words having the
same count must appear in lexicographic order.
For simplicity, valid words are defined as strings separated by white space, that consist only of
the letters in [A-Z] and [a-z]. Any word immediately followed or preceded by punctuation (e.g.
“house,” or “away!” must be discarded. Words that include non-letter symbols (e.g. “don’t” must
be discarded. Words and their plural are considered as separate words, i.e. “horse” and “horses”
are counted separately. Words that differ by upper or lower case characters are considered as
separate words, i.e. “You” and “you” are counted separately. White space is defined as the
characters skipped by operator>> when reading strings (this definition includes newline
characters).
Implementation
The STL string class should be used. Judicious use of associative containers and algorithms
can considerably reduce the coding effort. Your program must compile without any warning
within the C++11 definition of the standard (use the option -Wall –std=c++11 with g++).
Testing
Text files are provided together with corresponding reference output obtained e.g. with the
following command:
$ ./wfreq < TheOdyssey.txt > TheOdyssey.out
Submission
Create a tar file hw4.tar containing the file wfreq.cpp only and submit it using Gradescope.