Well, I just used your example data and it works fine.

How many spaces are there in your output? I've assumed that there are no spaces at the front of the line and that each field is delimited by a single space. If this is not the case then you will need to deal with the additional redundant spaces.