Rust example: HashMap word count
Count word occurrences using a HashMap in Rust.
Counts how often each word appears using std::collections::HashMap. The entry(w).or_insert(0) pattern inserts a default of 0 when a key is missing and returns a mutable reference that is then incremented. The keys are collected into a Vec and sorted so the output is deterministic before being printed with formatted width via println!.