Problem six solution