Run Length Encoded Brainfuck, 49 bytes
Since there are no variables in Brainfuck, I just used standard input and output instead.
The code 32+
should be interpreted as 32 +
s by the interpreter. Just replace them manually if your interpreter doesn't support RLE.
>,[32->+<[16-<[>++<-]>[<+>-]>-<]>[<<.[-]>>-]<,]<.
Expanded (non-RLE) version: (91 bytes)
>,[-------------------------------->+<[----------------<[>++<-]>[<+>-]>-<]>[<<.[-]>>-]<,]<.
The code assumes that EOF is encoded as 0.
Explanation
The following layout is used:
+---+---+------+
| x | a | flag |
+---+---+------+
Where x
is the ASCII byte to be printed, a
is the a character from standard input and flag
is 1 if a
was a space.
>, Read a character a into the second cell
[ While not EOF:
32- Decrease a by 32 (a -= ' ')
>+< Set the flag to 1
[ If a was not a space:
16- Decrease by 16 more ('0' == 32+16)
<[>++<-] a += 2*x
>[<+>-] Move it back (x = a)
>-< Reset the flag, it was not a space.
]>
[ If a was a space (flag == 1):
<<.[-] Print and reset x
>>- Reset the flag
]
<, Read the next caracter a
]
<. Print the last character x
Hello. Let's imagine that your technology is so advanced that it does not support ASCII. Would it be allowed to convert to the native character encoding, or would it have to convert ASCII to the native character encoding? I'm thinking
ZX81
here. – Shaun Bebbers – 2019-04-16T14:50:54.18016+1 for making a challenge without story and other fripperies, straight to the point – bebe – 2014-07-25T18:21:04.287
11@bebe Fictitious fantastical fripperies form half the fun. – qwr – 2014-07-25T23:59:57.413