Sensei's Library, problem 222

Adapted from Beginner Exercise 222 · OpenContent License

All problems