Solve problem 25 using Rust.