Solution to problem022