Solve problem 38 using Rust.