Return the full contents of your program, but inverted. How do your invert something? Well,

Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g A becomes z, and p becomes J.

Digits: Subtract from 9. E.g 6 becomes 3 and 5 becomes 4

Brackets: The brackets (){}[]<> become their corresponding closing/opening bracket. E.g [ becomes ] and > becomes <


  • & and | swap.
  • ' ' [space] and '\n' [newline] swap.
  • £ and $ swap, as do and ¥
  • ¢ and % swap
  • _ and - swap
  • " and ' swap
  • ? and ! swap
  • : and ; swap
  • / and \ swap
  • @ and # swap
  • ~ and ` swap
  • , and . swap
  • © and ® swap

All other characters become their Unicode inverse (subtract from 137,374). However, if the result is specified above, you must replace it again with the replacement provided. You only need to run a maximum of two replacements on each character, so no infinite loops.


  • Standard loopholes are disallowed

Good luck!

  • \$\begingroup\$ "the final product cannot be inverted any more" - but if you have one of the defined replacements (e.g. a letter) you can always invert it? So what do you really mean \$\endgroup\$
    – ASCII-only
    Commented Feb 22, 2019 at 10:41
  • 4
    \$\begingroup\$ Sure... but I highly doubt there is (or ever will be) a language that can do this in 4 bytes, and even if so, the solution wouldn't be very interesting so it's not really a problem. 4 characters... maybe, if you count combining marks on the same character as a single character, but that doesn't matter since we count in bytes here \$\endgroup\$
    – ASCII-only
    Commented Feb 22, 2019 at 10:49
  • 2
    \$\begingroup\$ Would have been much better if it were a little simpler, with fewer rules of inversion. But that's just my opinion (which I am not supposed to have). \$\endgroup\$
    – Arjun
    Commented Feb 22, 2019 at 11:46
  • 1
    \$\begingroup\$ Why did you accept my answer?.. :S It's way too soon, and it's not even the shortest.. \$\endgroup\$ Commented Feb 22, 2019 at 15:00
  • 1
    \$\begingroup\$ Hi there! I see that this and your previous challenge have lots of comments beneath them asking for clarification or other improvements. Since you're rather new here, I would like to point out that we have a place for challenges to get refined before they get posted here. We call it The Sandbox. I've liked both of your challenges so far, so I hope you continue to stay on PPCG and enjoy all the time you spend here. :-) \$\endgroup\$
    – Giuseppe
    Commented Feb 25, 2019 at 20:48

2 Answers 2


Perl 6, 142 bytes


Try it online!

Avoids using most of the annoying to represent characters. I think this could be shorter


05AB1E, 147 bytes




Try it online.

If this can be done in 4 bytes without creating a new language doing this specific task I'd love to see it.. >.> Also, based on the characters to invert I almost have the feeling it's deliberately targeting 05AB1E.. xD Probably not the case, but almost all those characters are pretty frequently used builtins in 05AB1E..



The shortest for 05AB1E is this one: 0"D34çý"D34çý (14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding at the ... here: 0"D34çý..."D34çý.... A short explanation of this quine:

0                 # Push a 0 to the stack (can be any digit)
 "D34çý"          # Push the string "D34çý" to the stack
        D         # Duplicate this string
         34ç      # Push 34 converted to an ASCII character to the stack: '"'
            ý     # Join everything on the stack (the 0 and both strings) by '"'
                  # (output the result implicitly)

Challenge part:

ε                 # Map each character in the string to:
 Ð.ïi             #  If it's an integer:
     9α           #   Get it's absolute difference with 9
 ëÐáQi            #  Else-if it's a regular letter ([A-Za-z]):
      žiD         #   Push "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" twice
         yk       #   Get the index of the current character
           52α    #   Get the absolute difference with 52
              è   #   And index it into the string again
 ë']Qi           '#  Else-if it's a "]":
      º           #   Mirror it to "]["
       ¦          #   And remove the first character so just "[" remains
  34ç             #  Push '"'
     39ç          #  Push "'"
        «         #  Merge them together: `"'`
         UX       #  Save it in variable `X`
  „,.             #  Push ",."
     VY           #  Save it in variable `Y`
       J          #  Join the character, `"'` and ",." together
        ć         #  Extract the head (the character)
         DŠ       #  Duplicate and triple-swap, so the stack becomes char, `"',.`, char
 ë         åi     #  Else-if the character is in this string:
             XÂ   #   Push variable `X` and its reverse
               ‡  #   Transliterate the character
             YÂ   #   Push variable `Y` and its reverse
               ‡  #   Transliterate the character
 ë                #  Else:
  Ç               #   Convert the character to its unicode value
   •2S¹•          #   Push compressed integer 137374
        α         #   Take the absolute difference between the two
         ç        #   Convert it to a character again
          J       #   Join (workaround because very high unicode characters are wrapped
                  #         in a list for some reason)
]                 # Close all if-else statements and map
 J                # Join every mapped character together to a single string
                  # (and output the result implicitly)

See this 05AB1E tip of mine (section How to compress large integers? to understand why •2S¹• is 137374.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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