Coding Challenge: Count Words in Moby Dick

The Challenge

The book "Moby Dick" by Herman Melville describes an epic battle of a gloomy captain against his personal nemesis, the white whale. Who of them is mentioned in the book more often?

Moby Dick word count

Your Task

Write a program that counts how often each word occurs in the book. Determine how often the words captain and whale occur. You will need different data structures for counting words and for sorting them.

When you know whether whale or captain occurs more often, you have mastered this challenge.

Use the 8 hint cards as necessary.

Background

You can find the full text for Herman Melville’s “Moby Dick” in the text file mobydick.txt and on www.gutenberg.org.

results matching ""

    No results matching ""