//sLine is the string for(int l = 0; l < sLine.length(); l++) { string sNumber; if(sLine[l] == \'-\') { sNumber.push_back(sLine[l]); sN
You output extra 0 for the characters which are not digits. The problem is that atoi returns 0 when it cannot convert the input, so your whitespaces are printed as zeroes.
0