From the course: Rust Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Count words

Challenge: Count words - Rust Tutorial

From the course: Rust Essential Training

Start my 1-month free trial

Challenge: Count words

(upbeat music) - [Narrator] Get ready. You've reached the final challenge for this course. And I've made this one complex. Not only to give you the opportunity, to work with vectors in hash maps. But also to use your experience, from the previous challenges. Your goal is to write a program, that reads in a given text file. Counts the number of times, each word occurs in that file. And then displays the most common word or words, along with how many times they appeared. That's a lot. So let's break it down into parts. Starting with reading in the file. Your program should accept the path, to the text file to read, as a command line argument. So for example, if your program was named count words. Hauling it from the command line on a text file, might look something like this. Depending on your operating system. Your program should then read the file. And of course include some sort of error handling. If…

Contents