Problem with ordering for loops
For an assigment, I have to read in a text document, reverse the lines, to the last line becomes the first and etc. then i have to take the words in the line and reverse them as well. It seems like everything should work with my program, however, it refuses to make the words backwards on the last line(which is actually the first line). another example is if there is only one line of text in the document, it just prints it out, it does not take the words and reverse them.
can someone please help me debug this problem? it seems like my forloops or prints or in the wrong spot