Solve problem 37 using Rust.