The free body diagram of the hammer has been drawn below:

In the above diagram, the weight of the hammer mg is acting in the downwards direction and the tension T created by the hammer is acting in the direction making an angle of from the X-axis. The x and y-component of the tension T are and acting along +x and +y-axis respectively.
From the above diagram, the net force acting in along x-axis is given as:
…(i)
Here, is the tension of the hammer, is the angle between the bus ceiling and the rope, is the mass of the hammer and is the acceleration due to gravity.
From the above diagram, the net force acting in along y-axis is given as:
…(ii)
Here, is the acceleration of the bus.
comparing the equation (i) and (ii)
Substitute the given values in the above equation.
Thus, the acceleration of the bus is .