Automatic algorithm for the numerical inverse scattering transform of the Korteweg-de Vries equation