Sensei's Library, problem 116

Adapted from Beginner Exercise 116 · OpenContent License

All problems