Removes the trailing whitespace at the end of each line in a string.