#05AB1E (legacy), 12 bytes
05AB1E (legacy), 12 bytes
Çb7jð0:¥ÄJ1ì
Uses the legacy version of 05AB1E, since j
implicitly joins the strings together, which requires an explicit J
after the j
in the new version of 05AB1E.
Try it online or verify all test cases.
Explanation:
Ç # Convert the (implicit) input-string to a list of ASCII code-points
# i.e. "Hi#" → [72,105,35]
b # Convert each integer to a binary string
# → ["1001000","1101001","100011"]
7j # Prepend each with spaces to make them length 7,
# and join everything together to a single string implicitly
# → "10010001101001 100011"
ð0: # Replace all those spaces with 0s
# → "100100011010010100011"
¥ # Get the deltas of each pair of 1s/0s
# → [-1,0,1,-1,0,0,1,0,-1,1,-1,0,1,-1,1,-1,0,0,1,0]
Ä # Get the absolute value of this
# → [1,0,1,1,0,0,1,0,1,1,1,0,1,1,1,1,0,0,1,0]
J # Join them all together
# → "10110010111011110010"
1ì # And prepend a 1
# → "110110010111011110010"
# (after which the result is output implicitly)