I did some testing with this code, and found it did not work if the integers on my input.txt were separated by tabs instead of spaces. Is there a way I can have the output print the same format as the input?
input: 1 <tab> 2 <tab> <tab> 3
output: 1 <tab> 2 <tab> <tab> 3
input: 1 _ 2 _ _ 3
output: 1 _ 2 _ _ 3
Note: <tab> represents tab spaces, and "_" represents regular spaces.