At first we have a 65 foot ladder, touching a wall 60 feet above the ground. If we draw that picture, we get a right triangle, where the hypotenuse is the ladder, and where we don't know the distance along the floor from the base of the ladder to the base of the wall. So we have a right triangle with lengths x, 60 and 65, and that's just a 5-12-13 triangle multiplied by 5, so x = 25.
So the base of the ladder is 25 feet from one wall. Since the walls are 64 feet apart, the base is 64 - 25 = 39 feet from the other wall. So now when we move the ladder, we have another right triangle with hypotenuse 65, and with a horizontal base of 39, and we don't know the vertical height between the base of the floor and the top of the ladder. So we have a right triangle with lengths 39, y, and 65, and that's just a 3-4-5 triangle multiplied by 13. So the missing side is (4)(13) = 52.