Solve problem 35 using Rust.