印刷可能なASCII文字の空でない文字列を取り込むプログラム(または関数)を作成します。
文字列内の文字のジグザグチェーンを隣接するすべての文字ペアで印刷(またはリターン)します。
/
通常のASCII順で最初の文字が2番目の文字の前にある場合。例えばB / A
\
最初の文字が通常のASCII順序で2番目の文字の後にある場合。例えばB \ A
-
最初の文字と2番目の文字が同じ場合。例えばA-A
だから、のための出力Programming Puzzles & Code Golf
になります
o
/ \
r z-z o e G l
/ \ / \ / \ / \ / \
P o r m-m n u l s & C d f
\ / \ / \ / \ / \ / \ / \ /
g a i g P e
\ /
入力文字列に文字が1つしかない場合、出力はその文字になります。
あなたのプログラムが扱うべきである、
/
、\
、および-
すべての他の文字とちょうど同じ。
例 -\//-- \ //-
:
\
/ \
- /-/
/ \
- --- \ /-/
\ / \ / \
-
\
単一のオプションの末尾の改行を除いて、出力に余分な改行はありません。(上記の例の空の行は、文字列の最後のスペースを保持しているため、無関係ではないことに注意してください。)任意の行の末尾にスペースを配置できます。
バイト単位の最短コードが優先されます。
もう1つの例-入力:
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
出力:
9 9 8 6 6
/ \ / \ / \ / \ / \
9 6 8 7 3 3 4 2 4 8 9 8-8
/ \ / \ / \ / \ / \ / \ / \
4 5 2 5 5 2 3-3 3 7 5 2 4 9 9 9-9 7
/ \ / \ / \ / \ / \ / \ / \ / \ / \
3 1 1 3 2 0 1 7 6 3 3 5 8 8 6
\ / \ / \ / \ / \ / \
. 1 1 5 2 9 9 3 7 1 4 6 8 9
\ / \ / \ / \ / \ / \ / \ / \ /
0 0 7 9 5 2 0 0 2 6 9-9 8 5 4 7
\ / \ / \ / \ / \ / \ / \ /
4 4-4 2 8 8 4 2 3 2 7 6
\ / \ / \ / \ /
0 6 8 3 1-1 0
\ / \ /
2 0
'\n'
のようなテンプレート文字列で、この