trailing whitespace other than \n is preserved on input