Assignment 2.5: Debugging for fun and profit! Solution