The most accurate response to how the planets in the solar system were formed is:
The remaining materials from the sun's formation clumped together due to gravity.
This explains the process of accretion, where dust and gas in the protoplanetary disk surrounding the young Sun came together under the influence of gravity, eventually forming the planets.