.
Let w be the width.
Then your equation is
w*(w+8) = (w+4)*((w+8)-5), or, which is the same,
w*(w+8) = (w+4)*(w+3),
w^2 + 8w = w^2 + 4w + 3w + 12,
w = 12.
Check. 12*(12+8) = 240.
(12+4)(12+3) = 16*15 = 240. ! Correct !
Answer. the original dimensions of the rectangle are 12 x 8 cm.
Solved.