Sensei's Library, problem 335

Adapted from Beginner Exercise 335 · OpenContent License

All problems