|>I|
Pruébalo en línea!
¡Pruébalo al revés!
Esto funciona para cualquier entrada que no contenga bytes nulos.
Explicación
Wow, he llegado al punto en que escribo esto a mano ...
El programa completo es |>I|I<|.
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
> Move one stack over to the right (which only contains zeros).
I Does nothing on zero.
| Does nothing on zero.
I Does nothing on zero.
< Move back to the initial stack.
| Reverse the input once more.
Como en la solución al desafío anterior, dado que el comando central |no hace nada, tampoco lo hace todo el programa.
El programa invertido es entonces |I>|<I|.
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
I Move the -1 one stack to the left and turn it into a +1.
> Move back to the initial stack.
| Reverse it again, but this time without the EOF marker.
< Move back to the left.
I Move the +1 back onto the initial stack and turn it into a -1 again.
| Reverse the entire stack. We now have the -1 as an EOF marker again at the bottom
and the rest of the stack has been reversed three times, i.e. one net reversal.
Curiosamente, si usamos este programa de inversión sin -mobtener una solución que funcione esta vez, los únicos bytes adicionales incurridos al omitir -mson los que obtenemos al duplicar el código.
|I<|>I|
Pruébalo en línea!
¡Pruébalo al revés!
Explicación
La versión inversa de este programa es |I>|<I|la misma que la anterior, por lo que podemos ignorar eso. Pero la versión no inversa es diferente. Como <>ahora apunta hacia el otro lado, el comando central termina sin hacer nada, por lo que el programa se convierte en un gato:
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
I Move the -1 one stack to the left and turn it into a +1.
< Move another stack to the left, which contains only zeros.
| Does nothing on zero.
Y así, >I|deshacer exactamente la primera mitad del programa.