K&R Exercises

Exercise 6-4: Words by frequency

Write a program that prints the distinct words in its input sorted into decreasing order of frequency of occurrence. Precede each word by its count.

A word is a run of letters, taken in lower case. Print each word on a line of its own as its count, a blank and the word, like 3 the. Words with the same count are in alphabetical order.

Test Cases

· space→ tab↵ newline

Submissions

No submissions yet