Exercise: Count words in a file

exercises projects

Similar to the exercise in which we counted digits, this time we would like to count words.

Give a file that contains lots of line, each line containig words separated by a space, we would like to count how many times each word appear. For the sake of simplicty in parsing, we can assume that there are no special pnctuations that we might need to get around. Just words separated by a space.

A small input file might look like this:

examples/data/text.txt

one word another word
a new sentence and a new word

Tools

Solutions

Other pages

Programming Exercises
Exercise: Implement the wc command of Linux/Unix (word count)

Author

Gabor Szabo (szabgab) Gabor Szabo