Shape evolution mechanism and characterization of two-dimensional MoS2 and NbS2