My previous challenge, Print invisible text was quite popular, likely due to how trivial it is.
However those more observant of you may have noticed that you're not really printing invisible text, because it's impossible to read what was inputted given only the output.
So I figured how about a real invisible text challenge.
Given a string consisting of only printable ASCII characters (
0x20-0x7E), convert each character to a distinct Unicode character (in UTF-8 encoding) that is not one of the 95 printable ASCII characters (any UTF-8 character outside of the
A string of printable ASCII characters, either as a string or character array/list
The input string with each character replaced with a distinct non-printable character. Each given character must have a corresponding non-printable character that is not used as the substitute for any other character.
If you are unable to print non-printable characters, you can output the character values instead.
For example if your code replaces all lowercase
0x01, you may not use
0x01 as the substitution for any other characters.
Your code must also be deterministic. This means that if, given the string
Hello, all lowercase
l's are replaced with
0x03, your code must also replace all lowercase
0x03 given any other string.
It's somewhat difficult to write testcases for this challenge, so I'll simply show the output as a list of hexcodes
input -> output "Hello" -> [0x01, 0x02, 0x03, 0x03, 0x04] "Hi!" -> [0x01, 0x05, 0x06] "" ->  " H " -> [0x07, 0x07, 0x07, 0x01, 0x07, 0x07, 0x07] "yo! " -> [0x08, 0x04, 0x06, 0x07]