When a heat interchange takes place between two bodies initially at different temperatures, the quantity of heat lost by the warm body is equal to that gained by the cool body, and some intermediate equilibrium temperature is finally reached. This is true provided that no heat is gained from or lost to the surroundings. In this case, we can apply the principle of conservation energy:
Heat lost by hot body = Heat gained by the colder body
From which we can easily calculate the specific heat capacity of the required solid material.