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.
27 Answers 27
Python 2, 7 bytes, cracks xnor's post
0xbin()
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 ()
-
6\$\begingroup\$ The syntax highlighting is working correctly :D \$\endgroup\$Bubbler– Bubbler2020年11月06日 02:31:20 +00:00Commented Nov 6, 2020 at 2:31
Haskell, doge doge's answer, 26 bytes
main=print()where{3
#""=3}
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.
R, cracks Robin Ryder's challenge
try(x %'"% y,T)
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 T
RUE 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.
-
1\$\begingroup\$ Very nice; I had looked at
%'"%
before (remembering the original illegal string challenge) but didn'ttry
it :-) \$\endgroup\$Giuseppe– Giuseppe2020年11月14日 01:35:29 +00:00Commented Nov 14, 2020 at 1:35
Jelly, 6 bytes, cracks caird coinheringaahing's
"
«{"
EDIT
I actually don't know why this works lmao
-
\$\begingroup\$ Looking back, I think this might be closer to the intended solution than we thought--
"
or)
at the end of the program can't parse as a single or double character literal, so it's basically the same asŒ
! \$\endgroup\$Unrelated String– Unrelated String2022年05月13日 00:07:24 +00:00Commented May 13, 2022 at 0:07
Jelly, 6 bytes, cracks caird coinheringaahing's
«{0¡
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.
-
\$\begingroup\$ Update:
0¡
could have just been/
! And@8
cracks without even having to avoid evaluation. \$\endgroup\$Unrelated String– Unrelated String2025年06月19日 21:19:26 +00:00Commented Jun 19 at 21:19
Python 3, cracks qwatry's challenge
Illegal text: int(A,B,C)
, with all ASCII but ~+2()
and newlines banned.
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)
Python 3 normalizes Unicode identifiers, so "fancy unicode" 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. 😂
Julia, 12 bytes, cracks @binarycat's answer
`\?""":"`
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.
-
\$\begingroup\$ 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. \$\endgroup\$binarycat– binarycat2020年11月15日 15:22:35 +00:00Commented Nov 15, 2020 at 15:22
Ruby, 21 bytes, cracks @dogedoge's first answer
%q(=end
#{"""'}
=end)
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/
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
Now the wrapper is a here doc. This approach also works for the first two cops (which don't include the /
).
Julia, 12 bytes, cracks @dogedoge's answer
"""?"""::Any
Define a (triple-quoted) string and assert it to be of type Any
(String
also works).
-
\$\begingroup\$ Yes the second one is the intended answer. \$\endgroup\$Aiden Chow– Aiden Chow2020年11月10日 01:47:32 +00:00Commented Nov 10, 2020 at 1:47
-
\$\begingroup\$ The first one uses alphanumeric characters so it's not a valid answer. \$\endgroup\$Aiden Chow– Aiden Chow2020年11月10日 01:50:56 +00:00Commented Nov 10, 2020 at 1:50
-
\$\begingroup\$ @AidenChow Ok, I removed it. \$\endgroup\$PkmnQ– PkmnQ2020年11月10日 01:55:02 +00:00Commented Nov 10, 2020 at 1:55
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 qwatry's revised answer
x: 1=2
or
x: 1+1=2
(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.
-
1\$\begingroup\$ Yep, that's the essentially solution the solution I had! \$\endgroup\$qwatry– qwatry2021年02月22日 17:05:41 +00:00Commented Feb 22, 2021 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])
.
-
\$\begingroup\$ I don't think this technically works under Desmos rules \$\endgroup\$Ethan Chapman– Ethan Chapman2021年03月17日 22:49:43 +00:00Commented Mar 17, 2021 at 22:49
JavaScript, cracks Etheryte's answer
void$=Array();console.log(...void$)
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()
.
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.
-
\$\begingroup\$ I wonder if there is another copy-pasteable solution that doesn't silently error? Currently looking for one. \$\endgroup\$Cloudy7– Cloudy72021年03月18日 03:19:29 +00:00Commented Mar 18, 2021 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.
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 ̄\_(ツ)_/ ̄
-
\$\begingroup\$ Technically, the answer would be
"sort(3,2
. \$\endgroup\$Makonede– Makonede2021年02月17日 20:49:49 +00:00Commented Feb 17, 2021 at 20:49 -
\$\begingroup\$ Dang it i just came up with this then found ur answer lol \$\endgroup\$Seth– Seth2021年02月22日 19:36:28 +00:00Commented Feb 22, 2021 at 19:36
Python 3, cracks Makonede's second challenge
raiseTABSystemExit
I am sure this is another unintended loophole...
-
\$\begingroup\$ sigh... this sucks \$\endgroup\$Makonede– Makonede2021年02月18日 18:47:38 +00:00Commented Feb 18, 2021 at 18:47
-
\$\begingroup\$ oops deny that edit please i didn't know SE converts tabs to spaces lol \$\endgroup\$Makonede– Makonede2021年02月18日 18:51:23 +00:00Commented Feb 18, 2021 at 18:51
Python 3, cracks Makonede's revised second challenge
raiser:str
Uses a type annotation. I think this is the actual solution you meant. 😏
-
\$\begingroup\$ Nope. Not quite. \$\endgroup\$Makonede– Makonede2021年02月18日 21:13:10 +00:00Commented Feb 18, 2021 at 21:13
-
1\$\begingroup\$ Not exactly the intended solution. Can't believe I missed this... I'll probably edit my answer a bit to avoid this loophole. LOL \$\endgroup\$qwatry– qwatry2021年02月22日 15:14:51 +00:00Commented Feb 22, 2021 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;
"
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.
Vyxal, 16 bytes, Cracks A Username's answer
Q
«Wi«»Wi»`Wi`Wi
Ez. Just quit before you get to the unavoidable stuff.
-
\$\begingroup\$ Unintended crack! Now try with
#
being banned.. \$\endgroup\$Deadbeef– Deadbeef2025年05月08日 09:38:00 +00:00Commented May 8 at 9:38
Rust, cracks deadbeef's v2 (no #
)
macro_rules! yay { ("'"'a) => () }
fn main() {
}
generates a warning for the unused macro, which i don't know how one would go about using. supressing the warning requires a #
, but warnings aren't errors :)
Explore related questions
See similar questions with these tags.