Solve problem 179 using C++/Rust.