in reply to Re^5: hackerrank.com question
in thread hackerrank.com question

Not a bug, but a 'feature'. Apparently, vim automatically appends every line with CR/LF characters per whatever file mode is set. The suggested path to fixing this is to use the ':set binary' command in conjunction with ':%!xxd' and ':%!xxd -r' to remove this extra character.

Replies are listed 'Best First'.
Re^7: hackerrank.com question
by writch (Sexton) on Sep 27, 2018 at 16:31 UTC
    Other than that, the way to resolve this is to use echo -n '<stuff>' > filename.

    That gives results like pasting with no explicit newline at the end used to in vi, and it's much less work.