I have the following code, but I have got the feeling that the line beginning with 'numofspaces +=' does not work as it should be. It should add the number of spaces of the iterator 'spaces' to the previous number of spaces of 'spaces'.
So after the first space (spacesstr = 1 + 1 = 2) commas must be 0.
After the next couple of spaces (spacesstr = 1 + 5 + 1 = 7) commas must be 2.
After the next couple of spaces (spacesstr = 1 + 5 + 12 + 1 = 19) commas must be 7. Does someone see the solution?