Inverse Sturm–Liouville problems with finite spectrum