27

# 反转和反转字符串

## 挑战

``````H -> 72  -> 1001000 -> 0001001 -> 1110110 -> 118 -> v
e -> 101 -> 1100101 -> 1010011 -> 0101100 -> 44  -> ,
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
, -> 44  -> 101100  -> 001101  -> 110010  -> 50  -> 2
-> 32  -> 100000  -> 000001  -> 111110  -> 62  -> >
W -> 87  -> 1010111 -> 1110101 -> 0001010 -> 10  -> (newline)
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
r -> 114 -> 1110010 -> 0100111 -> 1011000 -> 88  -> X
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
d -> 100 -> 1100100 -> 0010011 -> 1101100 -> 108 -> l
! -> 33  -> 100001  -> 100001  -> 011110  -> 30  -> (unprintable)
``````

## 计分

-15％奖金：如果您的程序从输出中删除了不可打印的内容。此字符必须至少为 32以下的所有字符（换行符除外）（字符10）

Conor O'Brien 2015年

xnor

Digital Trauma 2015年

@DigitalTrauma如果二进制代码为`0010000`，则应将其视为`10000`相反的代码`00001`
Downgoat 2015年

2

4

# CJam，14岁

``````q{i2bW%:!2bc}%
``````

``````q       read input
{…}%    convert each character
i     convert to number
2b    convert to base 2 (digit array)
W%    reverse
:!    invert each digit
2b    convert from base 2
c     convert to character
``````

### “可打印”版本，20-15％= 17

``````q{i2bW%:!2bc' ,N--}%
``````

anOKsquirrel

@anOKsquirrel对不起^^类似吗？

anOKsquirrel

W％如何工作？W是-1，所以……
ansquisrel 2015年

1
@anOKsquirrel请参阅此处

9

# Pyth，14个字节

``````smCi!M_jCd2 2z
``````

### 怎么运行的

`````` m           z  Map over the input with lambda d:
Cd        Cast d to character.
j  2       Convert to base 2.
_           Reverse the resulting array.
!M            Mapped logical NOT.
i        2     Convert back to integer.
C               Cast to character.
s               Concatenate the resulting characters.
``````

2

8

# Perl，57个 51个字符

（50个字符的代码+ 1个字符的命令行选项。）

``s/./\$_=unpack b8,\$&;s|0+\$||;"chr 0b".y|10|01|r/gee``

``````bash-4.3\$ perl -pe 's/./\$_=unpack b8,\$&;s|0+\$||;"chr 0b".y|10|01|r/gee' <<< 'Hello, World!'
v,dd2>
Xdl

bash-4.3\$ perl -pe 's/./\$_=unpack b8,\$&;s|0+\$||;"chr 0b".y|10|01|r/gee' <<< 'Hello, World!' | od -tad1
0000000    v    ,    d    d  eot    2    >   nl  eot    X    d    l   rs   nl
118   44  100  100    4   50   62   10    4   88  100  108   30   10
0000016
``````

1
51个字节：`-p` `s/./\$_=unpack b8,\$&;s|0+\$||;"chr 0b".y|10|01|r/gee``unpack b8,\$&`比短`sprintf'%b',ord\$&`，并且以相反的顺序解码。不幸的是，它还会产生尾随0，需要将其删除。
2015年

manatwork

42个字节：`-p` `s/./"chr 0b".unpack(b8,~\$&)=~s|1+\$||r/gee`。反转字符，无需音译;）
primo

7

# 的JavaScript（ES6 ES7），119 114 108个字节

``x=>String.fromCharCode(...[for(y of x)+('0b'+[...y.charCodeAt().toString(2)].reverse().map(z=>z^1).join``)])``
``<!--                               Try the test suite below!                              --><strong id="bytecount" style="display:inline; font-size:32px; font-family:Helvetica"></strong><strong id="bytediff" style="display:inline; margin-left:10px; font-size:32px; font-family:Helvetica; color:lightgray"></strong><br><br><pre style="margin:0">Code:</pre><textarea id="textbox" style="margin-top:5px; margin-bottom:5px"></textarea><br><pre style="margin:0">Input:</pre><textarea id="inputbox" style="margin-top:5px; margin-bottom:5px"></textarea><br><button id="testbtn">Test!</button><button id="resetbtn">Reset</button><br><p><strong id="origheader" style="font-family:Helvetica; display:none">Original Code Output:</strong><p><div id="origoutput" style="margin-left:15px"></div><p><strong id="newheader" style="font-family:Helvetica; display:none">New Code Output:</strong><p><div id="newoutput" style="margin-left:15px"></div><script type="text/javascript" id="golfsnippet">var bytecount=document.getElementById("bytecount");var bytediff=document.getElementById("bytediff");var textbox=document.getElementById("textbox");var inputbox=document.getElementById("inputbox");var testbtn=document.getElementById("testbtn");var resetbtn=document.getElementById("resetbtn");var origheader=document.getElementById("origheader");var newheader=document.getElementById("newheader");var origoutput=document.getElementById("origoutput");var newoutput=document.getElementById("newoutput");textbox.style.width=inputbox.style.width=window.innerWidth-50+"px";var _originalCode=null;function getOriginalCode(){if(_originalCode!=null)return _originalCode;var allScripts=document.getElementsByTagName("script");for(var i=0;i<allScripts.length;i++){var script=allScripts[i];if(script.id!="golfsnippet"){originalCode=script.textContent.trim();return originalCode}}}function getNewCode(){return textbox.value.trim()}function getInput(){try{var inputText=inputbox.value.trim();var input=eval("["+inputText+"]");return input}catch(e){return null}}function setTextbox(s){textbox.value=s;onTextboxChange()}function setOutput(output,s){output.innerHTML=s}function addOutput(output,data){output.innerHTML+='<pre style="background-color:'+(data.type=="err"?"lightcoral":"lightgray")+'">'+escape(data.content)+"</pre>"}function getByteCount(s){return(new Blob([s],{encoding:"UTF-8",type:"text/plain;charset=UTF-8"})).size}function onTextboxChange(){var newLength=getByteCount(getNewCode());var oldLength=getByteCount(getOriginalCode());bytecount.innerHTML=newLength+" bytes";var diff=newLength-oldLength;if(diff>0){bytediff.innerHTML="(+"+diff+")";bytediff.style.color="lightcoral"}else if(diff<0){bytediff.innerHTML="("+diff+")";bytediff.style.color="lightgreen"}else{bytediff.innerHTML="("+diff+")";bytediff.style.color="lightgray"}}function onTestBtn(evt){origheader.style.display="inline";newheader.style.display="inline";setOutput(newoutput,"");setOutput(origoutput,"");var input=getInput();if(input===null){addOutput(origoutput,{type:"err",content:"Input is malformed. Using no input."});addOutput(newoutput,{type:"err",content:"Input is malformed. Using no input."});input=[]}doInterpret(getNewCode(),input,function(data){addOutput(newoutput,data)});doInterpret(getOriginalCode(),input,function(data){addOutput(origoutput,data)});evt.stopPropagation();return false}function onResetBtn(evt){setTextbox(getOriginalCode());origheader.style.display="none";newheader.style.display="none";setOutput(origoutput,"");setOutput(newoutput,"")}function escape(s){return s.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}window.alert=function(){};window.prompt=function(){};function doInterpret(code,input,cb){var workerCode=interpret.toString()+";function stdout(s){ self.postMessage( {'type': 'out', 'content': s} ); }"+" function stderr(s){ self.postMessage( {'type': 'err', 'content': s} ); }"+" function kill(){ self.close(); }"+" self.addEventListener('message', function(msg){ interpret(msg.data.code, msg.data.input); });";var interpreter=new Worker(URL.createObjectURL(new Blob([workerCode])));interpreter.addEventListener("message",function(msg){cb(msg.data)});interpreter.postMessage({"code":code,"input":input});setTimeout(function(){interpreter.terminate()},1E4)}setTimeout(function(){getOriginalCode();textbox.addEventListener("input",onTextboxChange);testbtn.addEventListener("click",onTestBtn);resetbtn.addEventListener("click",onResetBtn);setTextbox(getOriginalCode())},100);function interpret(code,input){window={};alert=function(s){stdout(s)};window.alert=alert;console.log=alert;prompt=function(s){if(input.length<1)stderr("not enough input");else{var nextInput=input[0];input=input.slice(1);return nextInput.toString()}};window.prompt=prompt;(function(){try{var evalResult=eval(code);if(typeof evalResult=="function"){var callResult=evalResult.apply(this,input);if(typeof callResult!="undefined")stdout(callResult)}}catch(e){stderr(e.message)}})()};</script>``

Downgoat

2

ETHproductions

1
`Unexpected token '>'`当我尝试运行该代码段时，我明白了。
Paul R

1
@ETHproductions：谢谢-我只有Safari和Chrome，我想它们都不符合“ ES6”。
Paul R

1
@PaulR ES6或ECMAScript 6是JavaScript的最新一组新功能之一。有关更多信息，请参见此网站。还有一个兼容性表，显示哪些浏览器（和其他程序）支持哪些功能。这个答案特别需要“箭头函数”，“扩展运算符”和ES7的“数组推导”。
ETHproductions

5

# JavaScript（ES7），126字节-15％= 107.1

``x=>String.fromCharCode(...[for(y of x)if((c=+('0b'+[...y.charCodeAt().toString(2)].reverse().map(z=>z^1).join``))>31|c==10)c])``
``<!--                               Try the test suite below!                              --><strong id="bytecount" style="display:inline; font-size:32px; font-family:Helvetica"></strong><strong id="bytediff" style="display:inline; margin-left:10px; font-size:32px; font-family:Helvetica; color:lightgray"></strong><br><strong id="score" style="display:inline; font-size:32px; font-family:Helvetica">Score:</strong><strong id="scorediff" style="display:inline; margin-left:10px; font-size:32px; font-family:Helvetica; color:lightgray"></strong><br><br><pre style="margin:0">Code:</pre><textarea id="textbox" style="margin-top:5px; margin-bottom:5px"></textarea><br><pre style="margin:0">Input:</pre><textarea id="inputbox" style="margin-top:5px; margin-bottom:5px">"Hello, World!"</textarea><br><button id="testbtn">Test!</button><button id="resetbtn">Reset</button><br><p><strong id="origheader" style="font-family:Helvetica; display:none">Original Code Output:</strong><p><div id="origoutput" style="margin-left:15px"></div><p><strong id="newheader" style="font-family:Helvetica; display:none">New Code Output:</strong><p><div id="newoutput" style="margin-left:15px"></div><script type="text/javascript" id="golfsnippet">var bytecount=document.getElementById("bytecount");var bytediff=document.getElementById("bytediff");var score=document.getElementById("score");var scorediff=document.getElementById("scorediff");var textbox=document.getElementById("textbox");var inputbox=document.getElementById("inputbox");var testbtn=document.getElementById("testbtn");var resetbtn=document.getElementById("resetbtn");var origheader=document.getElementById("origheader");var newheader=document.getElementById("newheader");var origoutput=document.getElementById("origoutput");var newoutput=document.getElementById("newoutput");textbox.style.width=inputbox.style.width=window.innerWidth-50+"px";var _originalCode=null;function getOriginalCode(){if(_originalCode!=null)return _originalCode;var allScripts=document.getElementsByTagName("script");for(var i=0;i<allScripts.length;i++){var script=allScripts[i];if(script.id!="golfsnippet"){originalCode=script.textContent.trim();return originalCode}}}function getNewCode(){return textbox.value.trim()}function getInput(){try{var inputText=inputbox.value.trim();var input=eval("["+inputText+"]");return input}catch(e){return null}}function setTextbox(s){textbox.value=s;onTextboxChange()}function setOutput(output,s){output.innerHTML=s}function addOutput(output,data){output.innerHTML+='<pre style="background-color:'+(data.type=="err"?"lightcoral":"lightgray")+'">'+escape(data.content)+"</pre>"}function getByteCount(s){return(new Blob([s],{encoding:"UTF-8",type:"text/plain;charset=UTF-8"})).size}function getScore(s){var a=1;try{b=eval('('+s+')("Hello, World!")');if(b=="v,dd2>\nXdl")a=.85}catch(e){};return getByteCount(s)*a}function onTextboxChange(){var newLength=getByteCount(getNewCode());var oldLength=getByteCount(getOriginalCode());bytecount.innerHTML=newLength+" bytes";var diff=newLength-oldLength;if(diff>0){bytediff.innerHTML="(+"+diff+")";bytediff.style.color="lightcoral"}else if(diff<0){bytediff.innerHTML="("+diff+")";bytediff.style.color="lightgreen"}else{bytediff.innerHTML="("+diff+")";bytediff.style.color="lightgray"}newLength=getScore(getNewCode());var oldLength=getScore(getOriginalCode());score.innerHTML="Score: "+newLength;var diff=Math.round((newLength-oldLength)*100)/100;if(diff>0){scorediff.innerHTML="(+"+diff+")";scorediff.style.color="lightcoral"}else if(diff<0){scorediff.innerHTML="("+diff+")";scorediff.style.color="lightgreen"}else{scorediff.innerHTML="("+diff+")";scorediff.style.color="lightgray"}}function onTestBtn(evt){origheader.style.display="inline";newheader.style.display="inline";setOutput(newoutput,"");setOutput(origoutput,"");var input=getInput();if(input===null){addOutput(origoutput,{type:"err",content:"Input is malformed. Using no input."});addOutput(newoutput,{type:"err",content:"Input is malformed. Using no input."});input=[]}doInterpret(getNewCode(),input,function(data){addOutput(newoutput,data)});doInterpret(getOriginalCode(),input,function(data){addOutput(origoutput,data)});evt.stopPropagation();return false}function onResetBtn(evt){setTextbox(getOriginalCode());origheader.style.display="none";newheader.style.display="none";setOutput(origoutput,"");setOutput(newoutput,"")}function escape(s){return s.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}window.alert=function(){};window.prompt=function(){};function doInterpret(code,input,cb){var workerCode=interpret.toString()+";function stdout(s){ self.postMessage( {'type': 'out', 'content': s} ); }"+" function stderr(s){ self.postMessage( {'type': 'err', 'content': s} ); }"+" function kill(){ self.close(); }"+" self.addEventListener('message', function(msg){ interpret(msg.data.code, msg.data.input); });";var interpreter=new Worker(URL.createObjectURL(new Blob([workerCode])));interpreter.addEventListener("message",function(msg){cb(msg.data)});interpreter.postMessage({"code":code,"input":input});setTimeout(function(){interpreter.terminate()},1E4)}setTimeout(function(){getOriginalCode();textbox.addEventListener("input",onTextboxChange);testbtn.addEventListener("click",onTestBtn);resetbtn.addEventListener("click",onResetBtn);setTextbox(getOriginalCode())},100);function interpret(code,input){window={};alert=function(s){stdout(s)};window.alert=alert;console.log=alert;prompt=function(s){if(input.length<1)stderr("not enough input");else{var nextInput=input[0];input=input.slice(1);return nextInput.toString()}};window.prompt=prompt;(function(){try{var evalResult=eval(code);if(typeof evalResult=="function"){var callResult=evalResult.apply(this,input);if(typeof callResult!="undefined")stdout(callResult)}}catch(e){stderr(e.message)}})()};</script>``

jrich，2015年

@UndefinedFunction哦，很抱歉没有立即回复！我添加了一个`getScore()`检查测试用例`Hello, World!`是否符合要求的函数（它方便地包含换行符和不可打印的字符），并根据结果返回分数乘以0.85或1。是的，访问未压缩的摘录将是很棒的。:)
ETHproductions 2015年

jrich

4

## PHP - 187个182 163字节

``````<?php \$s=\$_GET["s"];\$m="array_map";echo join(\$m("chr",\$m("bindec",\$m(function(\$v){return strtr(\$v,[1,0]);},\$m("strrev",\$m("decbin",\$m("ord",str_split(\$s))))))));?>
``````

1

manatwork

@manatwork完全忘记了这一点。谢谢。
2015年

Blackhole，2015年

@Blackhole感谢您的信息，下次我会知道的。
2015年

Blackhole，2015年

3

# K5，28个字节

```````c\${b/~|{x@&|\x}@(b:8#2)\x}'
``````

``````  |\0 0 1 0 1 1 0 1
0 0 1 1 1 1 1 1
``````

``````  &|\0 0 1 0 1 1 0 1
2 3 4 5 6 7
``````

``````  {x@&|\x}0 0 1 0 1 1 0 1
1 0 1 1 0 1
``````

``````  `c\${b/~|{x@&|\x}@(b:8#2)\x}'"Hello, World"
"v,dd2>\nXdl"
``````

+1是因为我尝试过但无法找出一种摆脱前导零的短方法！
kirbyfan64sos

JohnE

3

# 朱莉娅77字节-15％= 65.45

``s->join(filter(isprint,[Char(parse(Int,join(1-digits(Int(c),2)),2))for c=s]))``

``````function f(s::AbstractString)
# digits() returns the digits in reverse order, so no explicit
# reverse() is needed
x = [Char(parse(Int, join(1 - digits(Int(c), 2)), 2)) for c = s]

# Remove unprintables, join into a string
return join(filter(isprint, x))
end``````

Glen O

Glen O

@GlenO感谢您的建议，但是这种方法会留下不可打印的十六进制代码，OP禁止这样做。`filter(isprint,)`两者同时使用有资格获得奖金并使其符合规则。
Alex A.

“如果一个字符导致无法打印，您可以选择输出它，但不必删除它们。”
Glen O

3

## PowerShell，199175（171-15％）= 145.35

``````param([char[]]\$a)(\$a|%{\$b=[convert]::ToString(+\$_,2);\$c=[convert]::ToInt32("\$((-join\$b[\$b.Length..0])-split0-replace1,0-join1)",2);if(\$c-gt31-or\$c-eq10){[char]\$c}})-join''
``````

### 解释：

• 我们创建一个新字符串`\$b`，它是我们输入的字母，转换为int `+\$_``[convert]` ed为底`2`
• 下一位，设置 `\$c`很棘手，所以让我们从内部开始并逐步解决问题
• 我们反转字符串 `\$b``(-join\$b[\$b.length..0])`
• 我们利用我之前的代码来反转二进制字符串然后将结果重新转换为字符串`"\$(..)"`
• 我们养活这个字符串变成一个不同的.NET呼叫`[convert]`Š `ToInt32`从基地`2`，最后将其存储在成`\$c`
• 如果`\$c`大于`31`或等于`10`，我们将其强制转换为char，并将该值保留在输出管道上（这是`-join''`上面收集和编辑的内容），否则在此特定迭代中什么也没留下

ew

### 例

``````PS C:\Tools\Scripts\golfing> .\reverse-and-invert-a-string.ps1 "Hello, World!"
v,dd2>
Xdl
``````

3

# C函数，63

``o;f(o,char *s){for(;*s;*s=o,s++)for(o=0;*s;*s/=2)o+=o+!(*s%2);}``

1

## Minkolang 0.11，26个字节

``````od?.(d2%,\$r2:d)xrI1-[2*+]O
``````

### 说明

``````od?.            Takes input as character, halting if empty
(d2%,\$r2:d)x    Converts to binary, inverting digits on the way
r               Reverses stack
I1-[2*+]        Converts to decimal
O               Outputs as character (if printable)
``````

1

# MATLAB，60个字节

``````@(y)[arrayfun(@(x)bin2dec([97-fliplr(dec2bin(x)) '']),y) '']
``````

1

# Python 3、95 91

``print(''.join(chr(int(''.join('10'[j>'0']for j in bin(ord(i))[:1:-1]),2))for i in input()))``

``````inp = input()
ints = (ord(i) for i in inp)
bins = (bin(i) for i in ints)
revs = (i[2:][::-1] for i in bins) #without leading '0b'
invs = (''.join('0' if j == '1' else '1' for j in i) for i in revs)
newInts = (int(i, 2) for i in invs)
newChars = (chr(i) for i in newInts)
newStr = ''.join(newChars)
print(newStr)``````

1

# Ruby，62个字符

``gets.bytes{|b|\$><<b.to_s(2).reverse.tr("01","10").to_i(2).chr}``

``````bash-4.3\$ ruby -e 'gets.bytes{|b|\$><<b.to_s(2).reverse.tr("01","10").to_i(2).chr}' <<< 'Hello, World!'
v,dd2>
Xdl

bash-4.3\$ ruby -e 'gets.bytes{|b|\$><<b.to_s(2).reverse.tr("01","10").to_i(2).chr}' <<< 'Hello, World!' | od -tad1
0000000    v    ,    d    d  eot    2    >   nl  eot    X    d    l   rs   nl
118   44  100  100    4   50   62   10    4   88  100  108   30   10
0000016
``````

1

# C＃，156个字节-15％= 132.6

``class P{static void Main(string[]a){try{for(int i=0,b,c;;){for(b=a[0][i++],c=0;b>0;b/=2)c=c<<1|1-b%2;if(c==10|c>31)System.Console.Write((char)c);}}catch{}}}``

``````class P{
static void Main(string[]a){
try{
for(int i=0,b,c;;){
for(b=a[0][i++],c=0;b>0;b/=2)
c=c<<1|1-b%2;
if(c==10|c>31)
System.Console.Write((char)c);
}
}
catch{}
}
}``````

1

# Javascript 123字节

``s=>[].map.call(s,s=>String.fromCharCode("0b"+s.charCodeAt().toString(2).split('').reverse().map(s=>s^1).join(''))).join('')``

1

# 视网膜，1107 629字节-15％= 534.65（非竞争）

Retina没有内置的功能可将字符转换为ASCII序数或反序...因此请注意其光泽长度。这处理可打印的ASCII，并删除不可打印的内容和换行符。字节数假定为ISO 8859-1编码。

``````
¶
±
S_`
%(S`±
{2`
\$`
}T01`-`_o
)Ms`.
\d+
\$*
+`(1+)\1
\${1}0
01
1
%O\$^`.

T`01`10
1
01
+`10
011
0

m`^1{1,31}\$

M%`1
m`^0¶?

126
~
125
}
124
|
123
{
122
z
121
y
120
x
119
w
118
v
117
u
116
t
115
s
114
r
113
q
112
p
111
o
110
n
109
m
108
l
107
k
106
j
105
i
104
h
103
g
102
f
101
e
100
d
99
c
98
b
97
a
96
`
95
_
94
^
93
]
92
\
91
[
90
Z
89
Y
88
X
87
W
86
V
85
U
84
T
83
S
82
R
81
Q
80
P
79
O
78
N
77
M
76
L
75
K
74
J
73
I
72
H
71
G
70
F
69
E
68
D
67
C
66
B
65
A
64
@
63
?
62
>
61
=
60
<
59
;
58
:
57
9
56
8
55
7
54
6
32

33
!
34
"
35
#
36
\$
37
%
38
&
39
'
40
(
41
)
42
*
43
+
44
,
45
-
46
.
47
/
48
0
49
1
50
2
51
3
52
4
53
5
¶

``````

1

# 爪哇，205-15％= 174.2

``````interface F{static void main(String[]a){for(int i=0,c,s;i<a[0].length();++i){c=a[0].charAt(i);s=Integer.numberOfLeadingZeros(c);c=~(Integer.reverse(c)>>s)&-1>>>s;if(c==10|c>31)System.out.print((char)c);}}}
``````

``````interface F {
static void main(String[] a) {
for (int i = 0, c, s; i < a[0].length(); ++i) {
c = a[0].charAt(i);
c = ~(Integer.reverse(c) >> s) & -1 >>> s;
if (c == 10 | c > 31) System.out.print((char)c);
}
}
}
``````

``````v,dd2>
Xdl
``````

1

# Japt，25个字节

``````UmX=>Xc s2 w mY=>Y^1 n2 d
``````

### 怎么运行的

``````         // Implicit: U = first item in input
UmX=>    // for each character X in U:
Xc s2 w  //  take the char-code of X, convert to binary, and reverse
mY=>     //  for each character Y in this:
Y^1      //   take Y XOR 1 (converts 1 to 0 and 0 to 1)
n2 d     //  convert the result back to decimal, then to a character
// Implicit: output last expression
``````

``````®c ¤w m^1 n2 d
``````

0

``````import Data.Char
import Numeric
r '0'='1'
r '1'='0'
s=map (chr.fst.head.(readInt 2 (`elem` "01") digitToInt).(map r).reverse.flip (showIntAtBase 2 intToDigit . ord)"")
``````

0

# Perl 6，66位元组

``perl6 -ne 'print grep /<-:C+[\n]>/,.ords».base(2)».flip.map({chr :2([~] \$_.comb.map(+!+*))})'``

``perl6 -ne 'print .ords».base(2)».flip.map({chr :2([~] \$_.comb.map(+!+*))})'``

（我用`»`而不是`>>`为了清楚）

0

# 果冻，6 个字节（无竞争）

``````OBU¬ḄỌ
``````

``````OBU¬ḄỌ Main link: z
O      Convert z to a list of character codes.
B     Convert the codes to bit lists.
U    Reverse the bits (not the lists).
¬   Invert the bits.
Ḅ  Convert back to decimal.
Ọ Convert back to string.
``````

0

## 球拍250 15％奖励= 212字节

``````(λ(s)(list->string(map integer->char(filter(λ(x)(or(> x 31)(= x 10)))(for/list((i(string->list s)))(string->number(string-append
"#b"(list->string(map(λ(i)(if(equal? #\0 i)#\1 #\0))(reverse(string->list(number->string(char->integer i)2))))))))))))
``````

``````(define (f s)
(list->string
(map
integer->char
(filter
(λ(x)(or(> x 31)(= x 10)))

(for/list ((i (string->list s)))
(string->number
(string-append
"#b"
(list->string
(map
(λ(i)(if(equal? #\0 i) #\1 #\0))
(reverse
(string->list
(number->string
(char->integer i) 2)
)))))))))))
``````

``````(f "Hello, World!")
``````

``````"v,dd2>\nXdl"
``````

0

# PHP，80字节

``while(a&\$c=\$argn[\$i++])echo chr(bindec(strtr(strrev(decbin(ord(\$c))),10,"01")));``

``````while(a&\$c=\$argn[\$i++])ctype_print(\$c=chr(bindec(strtr(strrev(decbin(ord(\$c))),10,"01"))))||"
"==\$c?print\$c:0;``````