The code works for the sample cases provided but shows run error on your ide What could be the reason?