A pulley changes the direction of the applied force, but does not change its magnitude. The mechanical advantage is the ratio of output force to input force, so must be 1 when the force magnitude does not change.
So 7 x = x2 -18 so you get the quadratic x^2 -7x -18 and then get 2 x -9= -18 and 2 + -9 = -7 so you get (x + 2) ( x - 9) so the positive solution would be x-9 = 0 so x= 9. Hope this helps :)