Create a program: Given a large text file with multiple strings, what would be the most efficient way to read the text file and count how many and which word appears the most repated word in a text file Output : the first 25 most repated words The text file's size is unknown. I add an image for output File.txt: ================================================================= Chapter 1 The house stood on a slight rise just on the edge of the village. It stood on its own and looked over a broad spread of West Country farmland. Not a remarkable house by any means - it was about thirty years old, squattish, squarish, made of brick, and had four windows set in the front of a size and proportion which more or less exactly failed to please the eye. The only person for whom the house was in any way special was Arthur Dent, and that was only because it happened to be the one he lived in. He had lived in it for about three years, ever since he had moved out of London because it made him nervous and irritable. He was about thirty as well, dark haired and never quite at ease with himself. The thing that used to worry him most was the fact that people always used to ask him what he was looking so worried about. He worked in local radio which he always used to tell his friends was a lot more interesting than they probably thought. It was, too - most of his friends worked in advertising. It hadn't properly registered with Arthur that the council wanted to knock down his house and build an bypass instead. At eight o'clock on Thursday morning Arthur didn't feel very good. He woke up blearily, got up, wandered blearily round his room, opened a window, saw a bulldozer, found his slippers, and stomped off to the bathroom to wash. Toothpaste on the brush - so. Scrub. Shaving mirror - pointing at the ceiling. He adjusted it. For a moment it reflected a second bulldozer through the bathroom window. Properly adjusted, it reflected Arthur Dent's bristles. He shaved them off, washed, dried, and stomped off to the kitchen to find something pleasant to put in his mouth. Kettle, plug, fridge, milk, coffee. Yawn. The word bulldozer wandered through his mind for a moment in search of something to connect with. The bulldozer outside the kitchen window was quite a big one. He stared at it. "Yellow," he thought and stomped off back to his bedroom to get dressed. Passing the bathroom he stopped to drink a large glass of water, and another. He began to suspect that he was hung over. Why was he hung over? Had he been drinking the night before? He supposed that he must have been. He caught a glint in the shaving mirror. "Yellow," he thought and stomped on to the bedroom.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter1: Creating Java Programs
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question

C++
Create a program: 


Given a large text file with multiple strings, what would be the most efficient way to read the text file and count how many and which word appears the most repated word  in a text file 

 

Output : the first 25 most repated words


The text file's size is unknown. 

I add an image for output 

 

File.txt:

=================================================================
Chapter 1

The house stood on a slight rise just on the edge of the village.
It stood on its own and looked over a broad spread of West
Country farmland. Not a remarkable house by any means - it was
about thirty years old, squattish, squarish, made of brick, and
had four windows set in the front of a size and proportion which
more or less exactly failed to please the eye.

The only person for whom the house was in any way special was
Arthur Dent, and that was only because it happened to be the one
he lived in. He had lived in it for about three years, ever since
he had moved out of London because it made him nervous and
irritable. He was about thirty as well, dark haired and never
quite at ease with himself. The thing that used to worry him most
was the fact that people always used to ask him what he was
looking so worried about. He worked in local radio which he
always used to tell his friends was a lot more interesting than
they probably thought. It was, too - most of his friends worked
in advertising.

It hadn't properly registered with Arthur that the council wanted
to knock down his house and build an bypass instead.

At eight o'clock on Thursday morning Arthur didn't feel very
good. He woke up blearily, got up, wandered blearily round his
room, opened a window, saw a bulldozer, found his slippers, and
stomped off to the bathroom to wash.

Toothpaste on the brush - so. Scrub.

Shaving mirror - pointing at the ceiling. He adjusted it. For a
moment it reflected a second bulldozer through the bathroom
window. Properly adjusted, it reflected Arthur Dent's bristles.
He shaved them off, washed, dried, and stomped off to the kitchen
to find something pleasant to put in his mouth.

Kettle, plug, fridge, milk, coffee. Yawn.

The word bulldozer wandered through his mind for a moment in
search of something to connect with.

The bulldozer outside the kitchen window was quite a big one.

He stared at it.

"Yellow," he thought and stomped off back to his bedroom to get
dressed.

Passing the bathroom he stopped to drink a large glass of water,
and another. He began to suspect that he was hung over. Why was
he hung over? Had he been drinking the night before? He supposed
that he must have been. He caught a glint in the shaving mirror.
"Yellow," he thought and stomped on to the bedroom.

ina@osboxes: ~/Kodning/Lab4
ina@osboxes:~/Kodning$ cd Lab4
ina@osboxes:~/Kodning/Lab4Ş make run
·/lab4
the: 2537
of: 1258
a: 1199
to: 1185
and: 1184
it: 797
he: 788
said: 672
in: 630
was: 607
you: 564
that: 536
: 486
i: 428
364 : חO
his: 348
arthur: 332
at: 328
for: 317
ford: 314
ina@osboxes:~/Kodning/Lab4$ []
II
Transcribed Image Text:ina@osboxes: ~/Kodning/Lab4 ina@osboxes:~/Kodning$ cd Lab4 ina@osboxes:~/Kodning/Lab4Ş make run ·/lab4 the: 2537 of: 1258 a: 1199 to: 1185 and: 1184 it: 797 he: 788 said: 672 in: 630 was: 607 you: 564 that: 536 : 486 i: 428 364 : חO his: 348 arthur: 332 at: 328 for: 317 ford: 314 ina@osboxes:~/Kodning/Lab4$ [] II
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Stack operations
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT