Count the characters - bit by bit!
Pyke, 1 6 bytes
1cn;1c
Try it here!
1c - chunk(size=1, input)
n;1 - noop.
c - count(^)
Half of this code is just no-ops...
00110001 - 1
01100011 - c
01101110 - n
00111011 - ;
00110001 - 1
01100011 - c
Pyth, 12 8 7 bytes
-1 byte thanks to @Loovjo
m+d/Qd{
{ # remove all duplicated elements from the (implicit) input
m # map each element (d) of the parameter (the set from previous operation)
/Qd # count the occurrences of d in Q
+d # concatenate with d
binary representation
01101101 m 00101011 + 01100100 d 00101111 / 01010001 Q 01100100 d 01111011 {
Try here
Befunge-93, 150 bytes
={<{p+}3/}*77\%*7{7:\+{}{1g}+3/*77\%*7{7:}=:_{}{}={}{}{v#{}{}`x1:~
}-}=*}{2*}97}:<$}={$_v#}!:-*84g+3/*77\%*7{7:}=:}:}+}1{}<_{@#
}{}{}={}{}{}={^.},\={<
Try it online!
I started by writing this as a regular Befunge program, which I golfed as much as possible. I then added padding to make sure the various characters in the program only appeared in permitted positions. This padding relied on the fact that unsupported commands are ignored in Befunge-93, so I just needed a sequence of unused characters whose bits aligned with the positions required (the sequence I used was ={}{}{}
).
The complicated bit was that the various branches between lines needed to line up correctly (e.g. the v
arrow in one line, would need to line up with the <
arrow below it). This was further complicated by the fact that the bridge command (#
) could not be separated from its adjacent branching arrow. Initially I tried generating the padding programatically, but in the end it was mostly a manual process.
Because of the size of the program I'm not going to list the full character analysis, but this is a sample from the beginning and the end:
= 00111101 0
{ 01111011 1
< 00111100 2
{ 01111011 3
p 01110000 4
+ 00101011 5
} 01111101 6
3 00110011 0
/ 00101111 1
...
{ 01111011 1
^ 01011110 2
. 00101110 3
} 01111101 4
, 00101100 5
\ 01011100 6
= 00111101 0
{ 01111011 1
< 00111100 2
The line breaks are treated as a newline characters, so will either be in position 1 or 3.