Perhaps you could read the file one character at a time.
Test each character that you read to see if it is a newline character (‘\n’).
If it is not a newline character, print the character that was read.
If it is a newline character, print “\n”.
Good Luck!