Revision 0c624f62-1ccc-40ce-a034-088941cbffb0 - Code Golf Stack Exchange
# [Alice], 12 bytes
i.h$#@.7%$io
[Try it online!]
### Explanation
This is a 1-D code operating in cardinal mode, so it's easy to follow its flow:
i Read a byte from input (pushes -1 on EOF)
.h Duplicate it and add 1 to the copy
$#@ If the result is 0, terminate.
.7% Duplicate the input again and compute its value modulo 7
This returns 6 for '0' (unicode value 48) and 0 for '1'
(unicode value 49)
$i If this last result was not 0, input another number.
This ignores every other '0' in the input
and moves to the following number (another '0')
o Output the last byte read
At the end, wrap back to the beginning of the line
[Alice]: https://github.com/m-ender/alice
[Try it online!]: https://tio.run/nexus/alice#@5@pl6Gi7KBnrqqSmf//v6GhoQEQGIJpEDJE4gAA "Alice – TIO Nexus"