Write the program using C++ and following question.
The program spends most of its time reading from and writing tofiles. It needs to do this to count the number of times that wordsappear in the original file. The second and third files aretemporary files that store the words that have not been counted.Once the program counts the number of times a word appears in theoriginal file it writes the word and its count to the census file.In addition, the word no longer appears in the temporary filesbecause the program does not write the counted word to thetemporary files..
To avoid these time consuming file operations, save the wordsand their counts in a vector. When the program reads a word, itsearches the vector for the word. If the word is in the vector itadds 1 to the word’s count; if the word is not in the vector, itadds the word and its initial count to the vector. When the programreads all the words in the original file, it writes the vector tothe census file.
Answer to Write the program using C++ and following question. The program spends most of its time reading from and writing to file…