/o.z/#Q/
@in.*.L\
オンラインでお試しください!
何も出力しません(Ordinalモードでは偽です)またはJabberwocky
(Ordinalモードでは空ではないため真正です。これは標準的な真理文字列値でもあります)。
説明
/.../#./
....*..\
これは、線形順序モードプログラムの一般的なフレームワークのわずかな変更です。/
真ん中には、(間に枢機卿モードで単一のオペレータを持つために使用される*
)、その後、我々は必要な#
通行の背中に序モードでそれをスキップします。線形プログラムは次のとおりです。
i..*.QLzno@
それを見てみましょう:
i Read all input as a string and push it to the stack.
.. Make two copies.
* This is run in Cardinal mode, so it implicitly converts the top two
copies to their integer value and multiplies them to compute the square.
. Implicitly convert the square back to a string and make a copy of it.
Q Reverse the stack to bring the input on top of the two copies of its square.
L Shortest common supersequence. This pops the input and the square from
the top of the stack and pushes the shortest string which begins with
the square and ends with the input. Iff the square already ends with the
input, this gives us the square, otherwise it gives us some longer string.
z Drop. Pop the SCS and the square. If the square contains the SCS (which
would mean they're equal), this removes everything up to the SCS from
the square. In other words, if the SCS computation left the square
unchanged, this gives us an empty string. Otherwise, it gives us back
the square.
n Logical not. Turns the empty string into "Jabberwocky" and everything
else into an empty string.
o Print the result.
@ Terminate the program.