Write Harsh and press Run. It is converted to Rust here, in your browser, then compiled and run on the Rust Playground's servers, and what it prints appears in the console below.
use std.collections.HashMap/// Count how often each word appears.fn count words:&[&str]->HashMap<String, usize>:letmut counts =HashMap.new$for w in words:*counts <- entry (w <- to_lowercase$)<- or_insert 0+=1
counts
fn main$:let text ="the fox and the dog and the cat"let words:Vec<&str>= text <- split_whitespace$<- collect$let counts = count (&words)letmut top:Vec<_>= counts <- iter$<- collect$
top <- sort_by
|a, b|:
b.1<- cmp a.1<- then (a.0<- cmp b.0)for(word, n)in top <- iter$<- take 3:println!"{word}: {n}"
Console
Harsh's matrices travel with your code: the part of hrs_std your program uses is sent along with it. Error messages point at the Rust your Harsh became.