Code
The highlighted line runs next. The pill shows the live values in the running call.
Cost
Work done so far, and how the two solutions compare
Strings and the encoded string
Grey cells are lengths and separators; coloured cells are string content
The highlighted line runs next. The pill shows the live values in the running call.
Work done so far, and how the two solutions compare
Grey cells are lengths and separators; coloured cells are string content
Keyboard: ← → step, Space play or pause. Input is a JSON list: up to 6 strings of up to 14 printable ASCII characters, and ␣ marks a space. The page runs encode on "Machine 1", then decode on "Machine 2" over the exact string encode produced. Follow-up: neither solution ever looks inside the string content, only at lengths, so the same idea works for any character set (with Unicode, count length in the same units you slice by).