The carriage return that was data
A line reader silently deletes a byte from an unterminated final record.
What’s going wrong
A log import removes CR when handling Windows line endings, but an unfinished last record loses meaningful data.
Stdin is one even-length hexadecimal string, or - for an empty stream (at most 8192 decoded bytes). LF (0a) terminates a record; remove its LF and at most one immediately preceding CR (0d). A bare CR is data. At EOF emit a nonempty unfinished record unchanged. Empty terminated records are valid; a final LF adds no extra record.
Print one JSON array of lowercase-hex record payloads. Bytes may be arbitrary; this exercise does not decode Unicode. Compare byte preservation as well as the number of records.
Expected behavior
Recognize complete delimiters before removing bytes, preserving data and empty-record boundary behavior.
Reproduction
6a6f620d
["6a6f620d"]
6a6f620d0a
["6a6f62"]
6a6f620a
["6a6f62"]
Before you begin
- Rust strings, slices and loops
- Read a failing example and compare exact output
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.