problem #6 solution