File7 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Write a program to count word frequency in a text file and display them with their number of times of

repetition in a sorted order.

Example:

$./a.out input.txt

input.txt

One night, they saw a firefly and


considered it a dab of fire. All the
monkeys in the group shouted ‘Fire,
Fire, Fire, Yeah we got fire!’

output: a-2, All-1, and-1, considered-1, dab-1, fire-5, firefly-1, got-1, group-1, in-1, it-1, monkeys-1,
night-1, of-1, One-1, saw-1, shouted-1, the-2, they-1, we-1, Yeah-1.

You might also like