Rust Challenge: Text Analysis

Learning Rust Through Small Challenges

John Philip
Rustaceans

--

Rust Mascot drinking Rust

In this mini Rust challenges, we will solve a problem using Rust. The goal of these challenges is to get comfortable reading and writing Rust code by solving various problems.

In case you missed the previous challenge, you can catch up on it here.

Rust pun for you

Why do Rust programmers never get lost? Because they always have their ‘cargo’ with them!

Challenge: Text Analysis

Write a Rust program that reads a text file and performs the following operations:

  1. Count the total number of words in the text.
  2. Calculate the average word length.
  3. Determine the most common word in the text.
  4. Identify the longest word in the text.
  5. Display the text with all words in reverse order.

--

--