Solution to problem #5 CS215 Lesson 4