You have been hired for your tech knowledge as a Secret Agent's sidekick to ensure that the good guy can get his job done and the world can be saved.

This is your last mission before retiring with a high paycheck and the gratitude of the whole world. But before you have to disarm the Evil Genius' Big Overly Massive BOMB (seems that the evil genius is a smart ass who likes recursive acronyms). Anyways you and your buddy are in the very core of the Evil Genius secret base, ready to disarm the BOMB that could wipe the continent out. In your previous mission you managed to get the disarm code that to your astonishment is just "PASSWORD_01". You connect your keyboard to the BOMB and when you are ready to go the Evil Genius' henchmen enter in with a barrage of bullets. Unfortunately one of these bullets impacts on your keyboard. "Finish the job while I distract those d*ckheads!" says your buddy and then begins to fire his gun. But how could you finish the job with only half a keyboard?

SPECS

  1. Write a program that outputs in any way you want the string PASSWORD_01 (uppercase).
  2. Since your keyboard has been hit by a bullet, you can only use these keys:

    1 2 3 4 5

    Q W E R T

    A S D F G

    < > Z X C

    Ctrl Shift Tab Space

    Using the Shift key, your keyboard allows you to use these characters:

    ! " · $ %

  3. You don't have any other hardware than the keyboard and the screen (a mouse for example), neither a file with the password written in your computer.

  4. You don't have an Internet connection.

  5. You can assume you have the interpreter shell / source editor opened before the bullets came in. Sadly you have not written anything in it before the keyboard was hit.

  6. You don't have a virtual keyboard. In fact the BOMB has a TOO_FUNNY detector that will make it explode if you try to use the Standard loopholes.

  7. Since your buddy is waiting for you to finish soon to scape of the Secret Base you will have to write the smallest code possible (so it's and !).

Good luck because the count down has begun!

HELP MODE: Also a KEY (only one Key you want from the keyboard, but not the Shift + Key or any other combination) has miraculously survived too. EG: You can use =, or 0 or /… This extra key cannot be any of the letters in PASSWORD_01 (so you cannot add P or O). Name that key in your answer. You have a penalization of 10 characters for use this key regardless of how many times you use the key.

  • 63
    Can I change the layout of the keyboard to DVORAK? – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Jun 11 '14 at 10:54
  • 41
    Do we get the enter key at least? – Οurous Jun 11 '14 at 11:51
  • 68
    Whitespace, here is your big chance! – german_guy Jun 11 '14 at 13:08
  • 39
    Why couldn't the password have been stewardesses? – codebreaker Jun 11 '14 at 18:07
  • 23
    Joke answer: I'm a spy, I switch to the backup keyboard hidden in my watch. – Nzall Jun 11 '14 at 20:50

17 Answers 17

up vote 40 down vote accepted

CJam - 24 + 10 (() = 34

"Q"c("ASSW"1$("aRD"(((T1

No additional key - 39

211 131%c"ASSW"211 132%c"RD"321 113%cT1

Try it at http://cjam.aditsu.net/

bash, vim and dc (343)

I'm sitting at a bash prompt which has been configured by the Evil Genius, and of course he has VISUAL=vim in the default environment. Using the default bash binding for edit-and-execute-command (C-x C-e) bash invokes $VISUAL and will execute its buffer contents on exit (ZZ). I type in the following sequence (Note: kbd-mode are commands issued in normal mode and control sequences):

  1. C-xC-e
  2. acat<<<45C-c4C-aaa

    Now the vim buffer contains cat<<<49a. Continuing ...

  3. 45C-c3C-aaa

  4. 54C-c41C-aaa
  5. 55C-c13C-aaa

    Now the vim buffer contains cat<<<49a48a95a68a. Continuing ...

  6. 51C-c31C-aaa

  7. 55C-c24C-aaa
  8. 44C-c43C-aaa
  9. 42C-c41C-aaa
  10. 42C-c41C-aaa
  11. 54C-c11C-aaa
  12. 55C-c25C-aaa>s

    Now the vim buffer contains cat<<<49a48a95a68a82a79a87a83a83a65a80a>s

    Get out of insert mode, save and exit

  13. C-cZZ

    The s file now contains a dc script that generates the desired string on the stack, now we need to add print commands.

  14. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

    Repeat the above command 9 times.

  15. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  16. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  17. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  18. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  19. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  20. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  21. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  22. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  23. C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ

  24. C-xC-eacat<<< f >>s

    Execute the dc script:

  25. C-xC-eadc sC-cZZ

Output:

PASSWORD_01

Contents of the s file:

49a48a95a68a82a79a87a83a83a65a80a
P
P
P
P
P
P
P
P
P
P
f
  • 4
    I was thinking to do a vim script because of the Ctrl character; good thinking to pair it with dc! Also, excellent solution :) – nneonneo Jun 12 '14 at 0:28
  • 2
    How long did it take you to write all those <kbd></kbd> tags? – justhalf Jun 13 '14 at 17:13
  • 15
    @justhalf: I wrote it in vim with <Leader>k bound like this map <Leader>k i<kbd></kbd>^[F>a, so it wasn't as bad as it looks :-). – Thor Jun 13 '14 at 23:25
  • 18
    Now it's apparent that Agent Thor knows his tool thoroughly. You deserve the retirement, sir! – justhalf Jun 14 '14 at 1:46

Ruby, 57 + 10 (*) = 67

$*<<4*4*5<<214%135<<44%25*5<<1%1
$><<"%cASSW%cRD%c%d1"%$*

This answer uses * and % to build the ASCII values of the missing characters (and 0 as Fixnum) and pushes them into $* (ARGV). This array is then used in combination with a format string to generate the correct password, which is printed with $><< ($> is stdout).

Ruby, 62 + 10 (.) = 72, no linebreak

$>.<< "%cASSW%cRD%c%d1".% %w%%<<311%231<<214%135<<321%113<<1%1

Roughly the same principle as the above version, except that here the array is built from an empty array literal (%w%%). Some fiddling with . is needed to get the desired operator precedence.

  • 12
    "This is your last mission before retiring with a high paycheck and the gratitude of the whole world." Congratulations, we all thank you :) – Timtech Jun 11 '14 at 14:01
  • 4
    The ultimate proof that Perl is one of the biggest inspiration of Ruby. – Pierre Arlaud Jun 11 '14 at 14:11
  • 11
    How did you do the linebreak? – Cephalopod Jun 11 '14 at 16:21
  • 4
    @Arian The same way nneonneo runs his Python code after typing it into the REPL ... I'll add a version without linebreak. – Ventero Jun 11 '14 at 21:26
  • Does the evil genius have ruby installed? – Mhmd Jun 13 '14 at 10:24

Whitespace (148 + 10 = 158)

Enter key needs to be used here.

SS+1010000L // Push code of P
TLSS        // Output character
SS+1000001L // Push code of A
TLSS        // Output character
SS+1010011L // Push code of S
SLS         // Duplicate top stack
TLSS
TLSS
SS+1010111L // Push code of W
TLSS
SS+1001111L // Push code of O
TLSS
SS+1010010L // Push code of R
TLSS
SS+1000100L // Push code of D
TLSS
SS+1011111L // Push code of _
TLSS
SS+0L       // Push 0
TLST        // Output number
SS+1L       // Push 1
TLST        // Output number
LLL         // End program

My notation's explanation:

  • S, +, 0 are spaces.
  • T, 1 are tabs.
  • L is new line.
  • // starts comment.

Each line is a command in whitespace language.

Demo

Python (2200 395 + 10)

exec"""exec"exec"+"%ca"%34+"%c52+53"""+"%c55+55"%44+"%c34"%44+"%c45+35"%44+"%c"%44+"""34%%cexec"%"""+"%c"%54+"""1+"%c"%34+"%%5%c+"%5"""+"%c"%55+"""+"%c"%34+"%c"""+"%c"%112+"""r%%c%%ct%%c%%cASSW"+"%c%%34+"%34+"%c%%cRD"%34+"%c%%"""+"%c"%55+""""%34+"%c+"%5"""+"%c"%55+"""+"%c%%c"%34+"%c%%"%34+"%c5+"%5"""+"%c"%55+"""+"%c"%34+"%c1%%c"+"%c%%4"%34+"%c+"%5"""+"%c"%54+"""+"%c"%34+"%c%%a"+"%c%%34"%34"""

I needed the + character (costing +10), which can be obtained from the numpad (or on certain key layouts).

Yeah, the BOMB probably went off while I was typing that.

The basic approach is to construct ever larger character sets by using exec and "%c"%(number). There are four execs nested inside each other. Gradually, my digit set progresses up from

  1. 12345
  2. 1234567 (6 = ASCII 54, 7 = ASCII 55)
  3. 123456789 (8 = ASCII 56, 9 = ASCII 57)
  4. 0x0123456789abcdef

so that in the final iteration it is possible to express any character (so that the innermost version can actually run any program at all).

Around 50% of the program is just quote characters ("%c"%34 is a double quote), because the nested nature of the exec statements demands "escaping" quote characters aggressively.

  • If you use the "+" from the numeric keypad, you are independent from the keyboard language. – celtschk Jun 12 '14 at 20:31
  • @celtschk: Good point! I will edit that in. – nneonneo Jun 12 '14 at 20:32
  • 1
    Rather than constructing digit sets with nested execs, couldn't you get numbers using arithmetic? Ex. exec '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c'%(112,114,51+54,55+55,1+115,32,4+35,25+55,11+54,31+52,31+52,32+55,24+55,31+51,13+55,41+54,3+45,4+45,4+35) – Kevin Jun 17 '14 at 12:09
  • 2
    Because you can't get both parens. (I did consider this!) – nneonneo Jun 17 '14 at 13:37
  • Additionally, Python doesn't have a lot of operators that bind more strongly than %. ** is one, but it tends to be fairly useless for constructing most terms. – nneonneo Jun 17 '14 at 13:39

Insomnia 39 35 31 29

This language comes up when I was looking around for a language that encodes its instructions with single ASCII character. The language actually operates on the decimal ASCII code of the character, so it is still quite flexible with half of the keyboard destroyed.

Drop it down further to 29 characters, which is possible after reducing memory usage and increases the search space:

FdFzt%dF<rGdt>tt Gtreeet t%4s

I decided to run my tweaked up program on the full set of allowed characters, and cut the solution down to 31 characters:

FdFGt dtreeC>tt FFdx<Fdtr ztq4s

I used a program to search for this solution. It is one among many solutions returned by my program, all with the same size.

Fddx>"eCeezdC>CefCdddzCzzfCqred>r4s

Old version constructed by hand. I remember staying up till morning to do this.

Fddx>"eCeezdC>Cef>dx"dCezeeedeCrqeeC%4s

Here is the Insomnia interpreter for testing.

  • 3
    +1 for the "staying up till morning" match with your programming language choice. – justhalf Dec 4 '14 at 2:36

Vim + PHP on Some Window Managers

65 keys in 44 strokes, with a 10-point penalty for using =.

aEACE<Alt+Tab>z=5<Alt+Tab>$xxxxaASSWRD<Alt+Tab>z=1<Alt+Tab>
$a$aA<Alt+Tab>==wxx$r1<^X>a1

A breakdown:

  • Alt+Tab appears to work like Esc with Vim, or perhaps with this terminal emulator. Thanks for teaching me something new!
  • aEACE<Alt+Tab>: Enter append mode and insert “EACE”. Exit.
  • z=5<Alt+Tab>: Perform spelling correction. Select 5, “PEACE”. Exit. (Esc seems to work as Enter here!)
  • $xxxxaASSWRD<Alt+Tab>: Go to the end of the line. Delete 4 characters and add ASSWRD, resulting in PASSWRD. Back to normal mode. (No, 4x won’t work.)
  • z=1<Alt+Tab>: PASSWORD is probably going to be the first correction for this. Select it.
  • $a$aA<Alt+Tab>: Go to the end of the line, and add a $aA. Back to normal mode.
  • ==: Format this line of PHP nicely, changing the camelCase $aA to $a_a. This also moves the cursor back to the start of the line.
  • wxx: Go forward a word; the cursor is now before $. Delete two characters – the $ and the a – to make PASSWORD_a.
  • $r1: Go to the end of the line and replace the current character (i.e. a) with 1, resulting in PASSWORD_1.
  • ^X: Decrement the integer under the cursor, resulting in PASSWORD_0.
  • a1: Finally, append 1, for PASSWORD_01!
  • I can't replicate == command, it just toggles large indentation mode in my vi setup (debian 7, v7.3.547) – Cengiz Can Jun 19 '14 at 14:34

bash + vim (56)

Borrowing the Ctrl-XCtrl-E bash trick from Thor's solution, here is how I would do it in bash+vim:

C-XC-E starts default editor (usually vim)

a starts insert mode

.space ASSW

C-Vx4f inserts O

RD

C-Vx5f inserts _

1

C-3 is equivalent to escape (not just in vim, but anywhere in a terminal)

C-X subtracts 1 from the 1 i just typed

a insert mode again

1 C-3

buffer content is now . ASSWORD_01

<< unindent line (a no-op, since line is not indented) and move cursor to 1st column

a

C-X start word completion

C-V complete with ex command

C-V 9 more times selects the entry Print

C-3 back to normal mode

XXXxx deletes rint 

< < back to column 1

s delete ., start insert mode

e c C-X C-V ex command completion once again, entry echo already selected because of the ec i just typed

space C-3 buffer content now echo PASSWORD_01

Z Z save buffer, close vim, bash executes file content, i.e. echo PASSWORD_01

By the way: C-3 has many useful brethren: C-J is Enter, C-I is Tab, C-H is Backspace, C-2 is C-@ (i.e. a null-byte). And for emacs users it is nice to know that Escape followed by another key is equivalent to Alt + that key. So, even without Escape and Alt you can still type Meta-x like this: C-3x

Python 2, 75889 bytes

No extra character!

Unfortunately, the code is super long. So instead, here's the code to generate the program:

x=[2**n for n in xrange(16)]
y=-5
print('exec"""exec'+x[7]*'%'+'c""'+x[6]*'%'+'cr'+x[-2]*'%'+'c'+x[-1]*'%'+'ct'+x[8]*'%'+'c'+x[-4]*'%'+'cASSW'+x[-5]*'%'+'cRD'+x[-3]*'%'+'c'+x[0]*'%'+'s1'+x[10]*'%'+'c '+x[9]*'%'+'c""'+x[y]*'%'+x[1]*'%'+'s'+x[y]*'%'+x[2]*'%'+'s'+x[y]*'%'+x[3]*'%'+'s'+x[y]*'%'+x[4]*'%'+'s'+x[y]*'%'+x[5]*'%'+'s"""'+'%`1>>1`%`2531>>5`%`321>>2`%`1521>>4`%`211>>1`%`221>>1`%112%34%34%34%34')

Try it online

(to run the code, change the outer print into an exec. Or, generate the program, then paste and run. Or copy from the pastebin linked below.)

Explanation:

The goal is to execute:

print"PASSWORD_01"

To avoid using ()+ chars, we have to use multiple string format operations chained together. This means that each step added effectively doubles the number of % characters needed for each previous step:

print"%cASSW%%cRD%%%%c%%%%%%%%c1"%80%79%95%48

This is not enough though, because some of the numbers required cannot be created, and neither can we create print. So we add a level of abstraction with exec for printing, and a level for the ASCII code points we cannot create to format with. The following is essentially my answer, but with each string of % reduced to a single one (note that the %s%s%s%s%s is not an accurate representation, failing to account for the literal %'s required before each):

exec"""exec%c""%cr%c%ct%c%cASSW%cRD%c%s1%c %c""%s%s%s%s%s""" % `1>>1`%`2531>>5`%`321>>2`%`1521>>4`%`211>>1`%`221>>1`%112%34%34%34%34

The First Step: Outermost exec:

exec""" ... ASSW%cRD ... %s%s%s%s%s""" % `1>>1` % `2531>>5` % `321>>2` % `1521>>4` % `211>>1` % `221>>1`
  1. 1>>1: 0, used for the 0 in PASSWORD_01
  2. 2531>>5: 79, used for inner exec to create O
  3. 321>>2: 80, used for inner exec to create P
  4. 1521>>4: 95, used for inner exec to create _
  5. 211>>1: 105, used for inner exec to create i
  6. 221>>1: 110, used for inner exec to create n

Second Step: Prepare Inner exec

After the above, the inner exec is something like this:

exec%c""%cr%c%ct%c%cASSWORD%c01%c %c""%79%80%95%105%110

Except that you wouldn't quite get that. Still wtih the simplifications, you'd get this:

exec%c""%cr%c%ct%c%cASSWORD%c01%c %c""798095105110

The literal %'s need to be included. So basically I had to add a bunch of them before each %s to end up with literal %'s left after all the formatting. 2**11 of them. Times five.

The rest of the outer exec string format operations are %112%34%34%34%34. The 112 is for p, and the others are quotation marks. After applying those, the result is something like this:

exec"""pr%c%ct"%cASSW%cRD%c01" """%79%80%95%105%110

But in reality it has a bunch more %. It's this:

exec"""pr%%%%%%%%c%%%%%%%%%%%%%%%%ct"%%cASSW%cRD%%%%c01" """%79%80%95%105%110

The final step is to simply run that, after which you get the necessary output.


Full code here: http://pastebin.com/rSFs6DiH

  • 6
    Impressive! You typed all that by hand before the BOMB exploded? Without making any mistakes (no backspace key)? You, sir or madam, deserve your pension. ;D – DLosc Feb 16 '17 at 2:17

Perl, (31+10 / 41+10 / 64+10)

(^ key used, 3 ways)

exec"easswsrdcqw"^"5    <  <AF"                   # exec "PASSWORD_01"

  • Valid if running as a system command qualifies as "output."

exec"QQZSqeasswsrdcqw"^"422<Q5    <  <AF"         # exec "echo PASSWORD_01"
  • Valid if I'm allowed to use external/OS commands. (Run here)

exec"EQAXqwQqQZQxqeasswsrdcqwxqq"^q!5434QZ4S534$S5    <  <AF$SS! 
                  # exec "perl -e\"die\\\"PASSWORD_01\\\"\""
  • Valid if I can execute Perl via the system. (Run here) <-- this one uses print instead of die

The scripts use Perl's bitwise string XOR operator ^, which does an XOR on the character bits of the two strings. This lets me recreate the missing characters for PASSWORD_01, and create the characters for the system command.

I made the three variants depending on how lenient the rules are. I assume that since variants 2 and 3 actually output the words on Ideone, the solutions are valid. I removed the little story I had here since I figured no one would read it, but you can read it in the edits if you're curious!

oOo code (300)

QwerTaSdfGzxCqwertAsDfgZxCQwerTasDfgZxcQweRtaSDfgZxCqwertAsDFgZXcQWeRtaSdFGzxcQwERTasdfGzxc
QwErtAsdFgzxcqWeRtaSdFGzxcQweRtaSDfGZxCqWErTAsDFgZXCqWerTasDfgZxcQweRtaSdfGzxCQwErTAsDFgZXC
qWertAsDfgzxcQwERtASdFGzXcqWeRTasdFGzXcQWeRtAsDfgzxcQwERtASdFGzXCqWerTaSDfgzXcQWErTaSdFgZxc
QwertaSdFgzXcQWertASdFgZXCq

Easy. (Linefeeds are optional, and just here to make the code "more readable") Code generator used:

o=lambda b,c:"".join(i.upper()if j else i for i,j in zip(__import__('itertools').cycle(c),map(int,"".join((3-len(i))*'0'+i for i in(bin('><[]-+.,'.index(i))[2:]for i in b)))))

The same code in a less silly encoding:

EeeeEeEeeEeeEeeeeeEeEeeEeEEeeeEeeEeeEeeEeeEeeEEeeEeEeeeeeEeEEeEEeEEeEeeEeEEeeeEeEEEeeeeEeee
EeEeeEeeEeeeeeEeEeeEeEEeeeEeeEeeEEeEEeEeEEeEEeEEeEEEeEeeEeeEeeEeeEeeEeeEeeEeeEEeEeEEeEEeEEE
eEeeeEeEeeeeeEeEEeEEeEEeEeeEeEEeeeEEeEeEEeEeEeEeeeeeEeEEeEEeEEeEEeEeeEeEEeeeEeEEEeEeEeEeEee
EeeeeeEeEeeEeEEeeeEEeEeEEEe

ferNANDo, 179 + 10 = 189 bytes

2 1
1 2 1 2 1 1 1 1
1 2 1 1 1 1 1 2
1 2 1 2 1 1 2 2
1 2 1 2 1 1 2 2
1 2 1 2 1 2 2 2
1 2 1 1 2 2 2 2
1 2 1 2 1 1 2 1
1 2 1 1 1 2 1 1
1 2 1 2 2 2 2 2
1 1 2 2 1 1 1 1
1 1 2 2 1 1 1 2

Try it online!

Enter used. I'd use 0 and 1 to make the code more readable but I can't use 0.

  • I think enter is allowed. – Conor O'Brien Sep 28 '16 at 22:19
  • 2
    OP didn't say Enter was allowed. – acrolith Sep 28 '16 at 23:35

JS-Forth, 103 bytes

The string will be returned on the stack as an array of characters.

12544 1 3 << >> 24 1 << 1521 4 >> 34 1 << 41 1 << 2531 5 >> 351 2 >> 332 2 >> 32 2 >> 131 1 >> 321 2 >>

Try it online - Commented version


Explanation:

I first found the list of allowed words. Essentially, the only things I could use that would be useful are:

  • 12345 Numeric constants
  • << Shift left
  • >> Shift right
  • s>f Push single to float stack
  • f>d Pop double from float stack
  • fsqrt Square root on float stack

So I could use numeric constants, bit-shift, and compute a square root using the following (>> replaces drop, shifting by 0 to remove the 0):

s>f fsqrt f>d >>

Fortunately, I found possible bit-shifts for every constant I needed to create that were shorter than using square roots. For the most part, I searched by simply printing each number squared, or a larger power of two if any of them contained a digit 6-0. Then, I realized I could use loss of precision from f>d to find more possibilities. (I could add to the number, but still get the same integer square root.) A bit later, I started using bit-shifting to find some, and then all, of the constants. The greater the >> bit-shift, the more I could add to the "magic number" and still get the same result. So I found the smallest bit-shifts I could use to get the necessary results. Even numbers could sometimes use <<, odds had to use >>.

Commented code (\ starts a comment):

\ 49
12544 1 3 << >>

\ 48
24 1 <<

\ 95
1521 4 >>

\ 68
34 1 <<

\ 82
41 1 <<

\ 79
2531 5 >>

\ 87
351 2 >>

\ 83 (x2)
332 2 >> 332 2 >>

\ 65
131 1 >>

\ 80
321 2 >>

gForth does not have the words << or >>. Instead it has lshift and rshift, which I could not use.

Stax, 91+10 bytes

"W"EEEd$"$"1 !$Re]"$""ASSW"R"$""a"EEE$"$"a$Re]R"$""RD"R"$""a"EEEd$"$""5"Re]R"$"1 !$R"$""1"R

Try it online!

Uses ] to make singletons.

Explanation

Let's see how "P" is generated and how the "ASSW" is appended without using the usual +.

"W"                             Push "W", or [87]
   E                            Convert to a scalar, 87
    E                           Convert to an array of digits, [8,7]
     E                          Push 8 on the stack, then push 7.
      d                         Pop the 7 and discard it.

                                Start making components of regex substitution
       $                        Pop 8, push "8"
        "$"                     Push "$"
           1 !                  Push 0. The space is necessary because normally one doesn't do 1! to obtain 0
              $                 Pop 0, push "0"
               R                Do regex substitution 's/$/0/g' on the string "8"

                                Basically doing "8"+"0" without using +
                e               Pop "80", push 80
                 ]              Singleton. Pop 80, push [80], or "P"
                  "$""ASSW"R    Use the same trick again to append "ASSW" to "P"

The rest are just repeating the same trick.

"a"EEE$"$"a$Re]R swaps the digits of "a" or [97] to make [79] or "O" and appends it to the string.

"$""RD"R appends "RD".

"$""a"EEEd$"$""5"Re]R uses "a" again to obtain "9" and discards the "7", then combines the "9" with a literal "5" to form [95] or "_", and appends it to the string.

"$"1 !$R obtains a zero by logical not of 1 and appends it to the string.

"$""1"R appends the final "1" and we are done.

Implicit output.

  • 1
    O_O ... this is clever. – recursive Feb 25 at 7:20
  • Thank you for your appreciation. I believe it can be made shorter (perhaps by choosing a different key?) though. – Weijun Zhou Feb 25 at 7:37

Befunge-98, 43 +10 = 53 bytes

"1qA·DR·WSSA·g"%,$,,,,$"s"%,,,$"c"%,%,,q

Try it online!

The 10 byte penalty is for the use of the , key (not sure why this couldn't be accomplished with Shift+<, but that seems to be the rule). And although the source is technically 40 characters, the three · characters contribute an additional three bytes because of their UTF-8 encoding.

Decimal, 190 180 + 10 = 190 bytes

12055D12025D41D301212055D12010D41D301212055D12025D41D12003D41D30130112004D41D301212055D12024D41D30112003D41D301212055D12013D41D301212055D12040D41D301212045D12003D41D30112001D41D301

Try it online! Decimal is an esoteric language that uses nothing but decimals and the letter D. However, I needed the +10 penalty because almost every command uses 0.

Luckily, all of the commands needed to print PASSWORD_01 don't require any numbers over 6:

  • 12...D - push a character
  • 2 - pop a value
  • 41D - pop top two stack values, multiply and push result
  • 301 - print DSI (default stack index)

By repeatedly pushing character values that only use the digits 1 through 5, then adding them, I can make the character values for each letter in PASSWORD_01.

Ungolfed and commented:

12055D     ; push char 55 to stack
12025D     ; push char 25 to stack
41D        ; pop [DSI] and [DSI-1], add and push result
3012       ; print from stack to output, pop
12055D     ; push char 55 to stack
12010D     ; push char 10 to stack
41D        ; pop top two stack values, add and push result
3012       ; print from stack to output, pop
12055D     ; push char 55 to stack
12025D     ; push char 25 to stack
41D        ; pop x2, add, push
12003D     ; push char 3 to stack
41D        ; pop x2, add, push
301301     ; print, print
12004D     ; push char 4 to stack
41D        ; pop x2, add, push
3012       ; print, pop
12055D     ; push char 55 to stack
12024D     ; push char 24 to stack
41D        ; pop x2, add, push
301        ; print
12003D     ; push char 4 to stack
41D        ; pop x2, add, push
3012       ; print, pop
12055D     ; push char 55 to stack
12013D     ; push char 13 to stack
41D        ; pop x2, add, push
3012       ; print, pop
12055D     ; push char 55 to stack
12040D     ; push char 40 to stack
41D        ; pop x2, add, push
3012       ; print, pop
12045D     ; push char 45 to stack
12003D     ; push char 3 to stack
41D        ; pop x2, add, push
301        ; print
12001D     ; push char 1 to stack
41D        ; pop x2, add, push
301        ; print

brainfuck, 400 + 10 (+) = 410 bytes

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<.>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..++++.<<++++++++++++++.+++.>>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++.>>>>++++++++++++++++++++++++++++++++++++++++++++++++.+.<

Try it online!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.