It is very simple program It will be slow because it read the whole text twice. I consider almost all side cases which I can imagine. I consider you input text not .csv (if the formet is fine, txt or something elses are fine), not integer or even string as a column number.