# Almost Illegal Strings, Mark II (Robbers)

This is the robbers' thread for 'Almost Illegal Strings'.

See the cop's thread for information on participating. A section from the post is included here for convenience.

## The Robbers' Challenge

Find an uncracked answer. Write a program in the language specified that contains as a contiguous substring the almost illegal string specified and does not error. Your program may not use any character in the set of banned characters, unless it is part of the almost illegal string. Your program does not need to be exactly what the cop had in mind. Post an answer to the robber's thread and leave a comment on the cops' answer to crack it.

# Python 2, 7 bytes, cracks xnor's post

0xbin()


Try it online!

The answer is easy to understand if syntax highlighting for above snippet works correctly.

So bad. The syntax highlighting did work correctly. But SO changed their render library... Anyway, above code is:

0xb in ()

• The syntax highlighting is working correctly :D Nov 6 '20 at 2:31

# R, cracks Robin Ryder's challenge

try(x %'"% y,T)


Try it online!

The 'almost illegal' string we're trying to use is '".

try attempts to run the code contained in its first argument. The second argument, silent (not explicitly named here) is set to TRUE to prevent output if the result is an error.

The first argument here attempts to apply the (nonexistant) %'"% function to (nonexistant) variables x and y.
The %...% notation - known as SPECIAL in R - allows us to incorporate characters that are usually forbidden for variables and function names, like '" in this case.

• Very nice; I had looked at %'"% before (remembering the original illegal string challenge) but didn't try it :-) Nov 14 '20 at 1:35

main=print()where{3
#""=3}


Try it online!

The idea here is that within a {} block whitespace rules are weakened a good deal. With that we can turn #" into the declaration of an infix function and write the rest of our program with no issues. From there we use where attached to our main function to start the block.

I don't really know why these blocks have weaker rules. I am just learning about this now as well. But for some reason I had a suspicion it might work and it does.

# Jelly, 6 bytes, cracks caird coinheringaahing's

“

«{”


Try it online!

EDIT

I actually don't know why this works lmao

# Jelly, 6 bytes, cracks caird coinheringaahing's



«{0¡


Try it online!

Instead of string literal weirdness, this uses the fact that arity mismatches don't cause errors until things are actually evaluated--{ doesn't try to turn a monad into a dyad so much as it calls a Python lambda assumed to have one argument from a Python lambda with two arguments, and 0¡ repeats it zero times.

# Julia, 12 bytes, cracks @binarycat's answer

\?""":"


Try it online!

Backticks in Julia delimit shell commands, as in Perl or Ruby. But unlike Perl or Ruby, the command isn't actually executed; rather, a Cmd object representing the command is created. Hence it doesn't matter that \?""":" isn't a valid shell command.

• Nice! This is actually really close to my intended solution, which was to write a custom command macro, but apparently you can just put a backslash in front, probably should have tried that. Nov 15 '20 at 15:22

# Python 3, cracks qwatry's challenge

Illegal text: int(A,B,C), with all ASCII but ~+2() and newlines banned.

𝔢𝔵𝔢𝔠(𝔠𝔥𝔯(22+22+22+~2+2)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+22)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+22+2+2+~2)+𝔠𝔥𝔯(22+22+22+~2+2+~2+~2+2)+𝔠𝔥𝔯(22+22+2+2))
𝔭𝔯int(A,B,C)


Try it online!

Python 3 normalizes Unicode identifiers, so "𝔣𝔞𝔫𝔠𝔶 𝔲𝔫𝔦𝔠𝔬𝔡𝔢" is turned into "fancy unicode".

This turns it into

exec(chr(22+22+22+~2+2)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+22)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+22+2+2+~2)+chr(22+22+22+~2+2+~2+~2+2)+chr(22+22+2+2))
print(A,B,C)


And when we expand the chr statements, we get 'A=B=C=0':

exec('A=B=C=0')
print(A,B,C)


And you can figure it out from there.

I would love to say I discovered it, but nah. This isn't the first time normalization memes have been posted here.

Also, I brute forced the ASCII arithmetic instead of calculating it, so it is not optimized. 😂

# Ruby, 21 bytes, cracks @dogedoge's first answer

%q(=end
#{"""'}
=end)


Try it online!

Wraps the almost illegal string in a single-quoted string (which doesn't allow interpolation).

# Ruby, 23 bytes, cracks @dogedoge's first and second answers

/#{'}=end
#{"""'}
=end/


Try it online!

Here's an alternative that doesn't use % (in response to a comment). This time we wrap in a regexp, interpolating a single quote to close the """' sequence that occurs later.

# Ruby, 28 bytes, cracks @dogedoge's third answer

<<S
#{'}=end
#{/"""'}
=end
S


Try it online!

Now the wrapper is a here doc. This approach also works for the first two cops (which don't include the /).

• Nice! but can you do it without %? Nov 6 '20 at 23:52
• @dogedoge Yep :) Nov 7 '20 at 0:18

# Julia, 12 bytes, cracks @dogedoge's answer

"""?"""::Any


Try it online!

Define a (triple-quoted) string and assert it to be of type Any (String also works).

# Desmos, 5 bytes, cracks Aiden Chow's answer


\{\}
• Yes the second one is the intended answer. Nov 10 '20 at 1:47
• The first one uses alphanumeric characters so it's not a valid answer. Nov 10 '20 at 1:50
• @AidenChow Ok, I removed it. Nov 10 '20 at 1:55

# Python 3, cracks qwatry's revised answer

x: 1=2


Try it online!

or

x: 1+1=2


Try it online!

(not entirely sure which it's supposed to be but it works either way).

I completely forgot how flexible type hints are until I cheated searched the grammar for the = character.

• Yep, that's the essentially solution the solution I had! Feb 22 at 17:05

# Desmos, to crack HitchHacker's cop

There is in fact a way to crack this answer without using notes. Type the closing parenthesis ) after the expression, then go back one character and type the closing bracket ]. The result, sort(3,2]), should be interpreted as sort([3,2]).

• I don't think this technically works under Desmos rules Mar 17 at 22:49

void$=Array();console.log(...void$)


Try it online!

This seems way too easy... Uses spread syntax ...expression to use the elements of void$ (initialized to Array(), an empty array []) as separate arguments to console.log. Since it's empty, it uses no arguments, which is perfectly valid as well; it just calls console.log(). # JavaScript, cracks Etheryte's revised answer eval(...void 0||Array())  Try it online! # Desmos, cracks HitchHacker's answer \sort(3,2  Desmos programs are normally scored based on the text pasted into the textbox. Pasting in invalid-formatted text simply does nothing, which doesn't meet the error criteria of showing a "danger sign" laid out by HitchHacker. The easiest way to do this is by using a \ before sort. Desmos doesn't recognize "sort" as an escapable sequence like \left or \operatorname or even \sin so it simply ignores the whole program. • I wonder if there is another copy-pasteable solution that doesn't silently error? Currently looking for one. Mar 18 at 3:19 # Python 3, cracks Makonede's answer Code contains unprintable characters, so is provided as a hexdump: 00000000: 2300 0400 040a 3f22 2222 3f27 2727 3f #.....?"""?'''?  Derived from feersum's comment on an identical Python answer to the original find an illegal string challenge. I made it slightly shorter and adjusted it to the banned characters in this challenge, but have no idea how or why this works. Try it online! # Desmos, cracks HitchHacker answer The solution is in the answer, note is the key: instead of evaluating it as an expression the illegal string is put in a note ¯\_(ツ)_/¯ • Technically, the answer would be "sort(3,2. Feb 17 at 20:49 • Dang it i just came up with this then found ur answer lol – Seth Feb 22 at 19:36 # Rust -Z unstable-options --pretty normal, cracks @Deadbeef's answer const x:! =1;  Not sure if this is the intended interpretation of "you may pass any flags to rustc if you like." or a loophole. I could just do --help but this one actually parses the file and needs a sorta valid Rust program. Specifically, the --pretty option on Nightly will just format the code instead of compiling it. # Python 3, cracks Makonede's challenge  raiser=3  Try it online! Should've banned =... # Python 3, cracks Makonede's second challenge  raiseTABSystemExit  Try it online! I am sure this is another unintended loophole… • sigh... this sucks Feb 18 at 18:47 • oops deny that edit please i didn't know SE converts tabs to spaces lol Feb 18 at 18:51 # Python 3, cracks Makonede's revised second challenge  raiser:str  Try it online! Uses a type annotation. I think this is the actual solution you meant. 😏 • Nope. Not quite. Feb 18 at 21:13 # Python 3, cracks qwatry's answer foo1=2  Try it online! The string to crack is 1=2. • Not exactly the intended solution. Can't believe I missed this... I'll probably edit my answer a bit to avoid this loophole. LOL Feb 22 at 15:14 # Zsh, cracks pxeger's post, cracked after being safe. Did I get the rules correctly? a=1;: " #include <cstdlib> #include <iostream> int main() { srand(time(NULL)); hello(); return rand() % 2; } /* main a=0 \ print "$((1/\$a))"
*/

void hello() std::cout << "Hello, World!" << std::endl;
"


Try it online!

# Vim, 6 bytes, cracks Aaron Miller's

<C-w>n<Esc><Esc>ZQ


## What it does

• Make a new window first.
• Close it by last four keys.

# Vim, 5 bytes, cracks Aaron Miller's

<C-w>n<Esc>ZQ


Same as above.

Q
«Wi«»Wi»WiWi