Write a program that outputs the number 0.
That's a bit trivial, isn't it?
Let's sort all distinct permutations of your code in lexicographical order. When any of these codes are run, it should output the its location in the array (0-indexed or 1-indexed).
This means that your code must be the lexicographically smallest permutation of your code possible.
For example, if your code is ABB
, then ABB
-> 0; BAB
-> 1; BBA
-> 2.
Rules
- Out of all distinct permutations of your code, it must be the lexicographically smallest.
- Your program must be at least 3 bytes long.
- "Output" represents any acceptable output: on the stack, to STDOUT, as a return value, as an exit code, etc.
- Your program is to not take any form of input.
- This is code-bowling, so longest code wins.