One leg of a right triangle is 7 inches longer than the other leg, and the hypotenuse is 35 inches. Find the lengths of the legs of the triangle.