remove newline at end of input