Rust Challenge: Text Analysis
Learning Rust Through Small Challenges
Published in
3 min readOct 23, 2023
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:
- Count the total number of words in the text.
- Calculate the average word length.
- Determine the most common word in the text.
- Identify the longest word in the text.
- Display the text with all words in reverse order.