ドットを回転させる


46

はじめに

2×nブール行列は、4文字の文字列として表すことができます. ':。文字列には「上行」と「下行」があり、1を表すドットと0を表す空のスペースがあります。たとえば、2×6行列

1 0 1 0 0 1
0 0 0 1 0 1

として表すことができます' '. :。あなたの仕事は、この「圧縮された形式」のマトリックスを取り、そのエントリーをコンベヤーベルトのように時計回りに1ステップ回転させることです。

入力

あなたの入力は文字の上の単一の文字列. ':です。その長さは少なくとも2であることが保証されています。

出力

出力は入力文字列になりますが、すべてのドットは時計回りに1ステップ回転します。より明確に言えば、一番上の行のドットは、右に1つずつ配置されていますが、一番右のドットは下に移動します。下の行のドットは左に1ステップ移動しますが、左端のドットは上に移動します。特に、出力文字列は元の文字列と同じ長さでなければならず、空白は重要です。

:..:'.2×6行列に対応する入力文字列を考えます

1 0 0 1 1 0
1 1 1 1 0 1

この行列の回転バージョンは

1 1 0 0 1 1
1 1 1 0 1 0

これは文字列に対応します::. :'

ルールとスコアリング

完全なプログラムまたは関数を作成できます。最小のバイトカウントが優先され、標準の抜け穴は許可されません。入力と出力を引用符で囲むかどうかを決定できます。また、1つの末尾の改行も両方で受け入れられます。

テストケース

これらのテストケースは二重引用符で囲みます。

"  " -> "  "
" ." -> ". "
". " -> "' "
"' " -> " '"
" '" -> " ."
": " -> "''"
"''" -> " :"
":." -> ":'"
":.'" -> ":'."
"..." -> ":. "
": :" -> "':."
"':." -> ".:'"
".:'" -> ": :"
"    " -> "    "
"::::" -> "::::"
":..:'." -> "::. :'"
" :  .:'" -> ". '.. :"
": ''. :" -> "'' :'.."
"........" -> ":...... "
"::::    " -> ":::''   "
"    ::::" -> "   ..:::"
" : : : : " -> ". : : : '"
".'.'.'.'.'" -> "'.'.'.'.'."
".. ::  '.' :." -> ": ..'' .' :.'"
".'  '.::  :.'. . ::.'  '. . .::'  :.'." -> "' ' .:.''..'.'. ..:' ' .'. ...'''..'.'"

回答:


11

JavaScript(ES6)、100 97 93バイト

@ edc65のおかげで4バイト節約

s=>s.replace(/./g,(c,i)=>" '.:"[(i?q>' '&q!=".":c>"'")+(q=c,s[++i]?s[i]>"'":c>' '&c!=".")*2])

使い方

これは、現在の文字の前後の文字に対していくつかの計算を実行することにより、挿入する必要がある文字を決定します。合計:

  • 最初の文字で、下部にドットがある場合、2。
  • それ以外の場合、前にあるものの上にドットがある場合、2。
  • それが最後の文字で、上にドットがある場合、1;
  • それ以外の場合、その下にドットがある場合、1。

これは、スペースの場合は0、1の場合'、2の場合.、および3の場合の合計です:

テストスニペット


よくやった。保存4:s=>s.replace(/./g,(c,i)=>" '.:"[(i?q>' '&q!=".":c>"'")+(q=c,s[++i]?s[i]>"'":c>' '&c!=".")*2])(2つの部分を反転させて、iを増やし、正規表現を減らし、テストを簡単にします。前のcをqに保存します)
-edc65

@ edc65ヒントをありがとう!
ETHproductions

9

Perl、70 69 64 63 61 60バイト

+2を含む -lp

STDINの入力文字列で実行します。たとえば

perl -lp rotatedots.pl <<< ":..:'."

rotatedots.pl

y/'.:/02/r=~/./;y/.':/01/;$_=$'.2*chop|$&/2 .$_;y;0-3; '.:

説明

y/'.:/02/r                                        Construct bottom row but
                                                  with 2's instead of 1's
                                                  Return constructed value
                                                  (for now assume space
                                                  becomes 0 too)
          =~/./                                   Match first digit on bottom
                                                  row into $&. $' contains
                                                  the rest of the bottom row
                y/.':/01/                         Convert $_ to top row
                                                  (again assume space
                                                  becomes 0 too)
                             $'.2*chop            Remove last digit from
                                                  the top row, multiply by 2
                                                  and append to bottom row
                                       $&/2 .$_   Divide removed digit by
                                                  2 and prepend it to the
                                                  top row
                          $_=         |           "or" the top and bottom
                                                  row together. The ASCII
                                                  values of 0,1,2,3 have
                                                  00,01,10,11 as their last
                                                  two bits.

y;0-3; '.:                  Convert the smashed together top and bottom rows
                            to the corresponding representation characters.
                            Drop the final ; since it is provided by -p
                            (after a newline which doesn't matter here)

上記のコードではスペースは変換されません。計算のために/2*2、それはのように振る舞うとなります0。他の位置では「or」の一部になりますが、1ビットのスペースは1ビットのサブセットであり、いずれかの数字0と論理和をとった0場合と同じ効果があります。or-edされた文字がスペースである場合にのみ、になる代わりにスペースのままになります0。しかし、0とにかくスペースに戻されるので大丈夫です。


8

網膜、66

  • @daavkoのおかげで2バイト節約
  • @randomraのおかげで4バイト節約
:
1e
\。
1f
'
0e

0f
T`h`Rh` ^。|。$
(。)(\ d)
$ 2 $ 1
e1
:
e0
'
f0

f1
。

説明

入力から始めます。

: ''. :

最初の4段階では、上/下の行にそれぞれ1/ eをtrueに、0/ fをfalseを使用してマトリックスを作成します。上下の列はインターレースされています。これにより、次のような文字列が生成されます。

e1f0e0e0f1f0e1

ただし、これら4つのステージは、文字と数字の順序を逆にするだけで、下の行1を効果的に左に移動します。

1e0f0e0e1f0f1e

Transliterationステージは唯一、すなわち代わる最初と最後の文字の進数字を逆に0-9a-fしてf-a9-0。これには、左下の文字を上の行に移動し、右上の文字を下の行に移動する効果があります。

ee0f0e0e1f0f11

次に、次のステージですべての文字と数字のペアが交換され、それによって上の行1が右に移動します。以前はこれがでしたが(\D)(\d)(.)(\d)置換は常に左から右に行われるため、最後の2桁が誤って一致することはないため、最後から2番目の文字がすでに置換されているため、これで十分です。マトリックスは必要に応じて完全に回転しました。

e0e0f0e1e0f1f1

最後の4つのステージは、元の形式に変換されます。

'' :'..

オンラインでお試しください。

各入力行を個別に処理できるように、m追加されたすべてのテストケース(行ごとに1つ)T


7

ゼリー、32 30 29バイト

,Ṛe€"“':“.:”µṪ€;"ṚU1¦ZḄị“'.: 

末尾のスペースに注意してください。オンラインでお試しください!または、すべてのテストケースを確認します

バックグラウンド

まず、入力文字列(例:):..:'.とその逆を検討します。

:..:'.
.':..:

一番上の行の各文字について、それがに属しているかどうかを確認し':、一番下の行の各文字について、に属しているかどうかを確認し.:ます。これはブール値の2D配列を与えます

100110
101111

これは質問のマトリックスで、下の行が逆になっています。

各行の最後のブール値を削除し、行の順序を逆にし、ブール値を元の順序で追加し、最後に最上行を逆にします。

100110    10011    10111    010111    111010
101111    10111    10011    110011    110011

これにより、質問から回転したマトリックスが生成されます。

最後に、ブール値の各列を2進数と見なし'.:、適切な文字を取得するためのインデックスを作成します。

332031    ::. :'

使い方

,Ṛe€"“':“.:”µṪ€;"ṚU1¦ZḄ‘ị“'.:   Main link. Argument: S (string)

 Ṛ                              Reverse S.
,                               Form a pair of S and S reversed.
     “':“.:”                    Yield ["':" ".:"].
  e€"                           For each character in S / S reversed, check if it
                                is an element of "':" / ".:".
                                Yield the corresponding 2D array of Booleans.

            µ                   Begin a new, monadic chain.
                                Argument: A (2D array of Booleans)
             Ṫ€                 Pop the last Boolean of each list.
                 Ṛ              Yield the reversed array of popped list.
               ;"               Prepend the popped items to the popped lists.
                  U1¦           Reverse the first list.
                     Z          Zip to turn top and bottom rows into pairs.
                      Ḅ         Convert each pair from base 2 to integer.
                        “'.:    Yield "'.: ".
                       ị        Retrieve the characters at the corr. indices.

5

Pyth、 38 36

L,hb_ebsXCyc2.>syCXzJ" .':"K.DR2T1KJ

ジャクベのおかげで2バイト!

ここで試してみるか、テストスイートを実行してください

説明:

L,hb_eb         ##  Redefine the function y to take two lists
                ##  and return them but with the second one reversed
                ##  Uses W to apply a function only if it's first argument is truthy
XzJ" .':"K.DR2T ##  Does a translation from the string " .':" to
                ##  .DR2T which is [0,1,2,3...,9] mapped to divmod by 2
                ##  (which is [0,0],[0,1],[1,0],[1,1], then some extra, unused values)
                ##  we also store the string and the list for later use in J and K
.>syC ... 1     ##  zip the lists to get the bits on top and below as two separate lists
                ##  apply the function y from before, flatten and rotate right by 1
Cyc2            ##  split the list into 2 equal parts again, then apply y and zip again
sX ... KJ       ##  apply the list to string transformation from above but in reverse
                ##  then flatten into a string

あまりにも複雑すぎたようです^^説明を追加してもいいですか?
デンカー

1
@DenkerAffeが追加中だった:)追加!
FryAmTheEggman

あなたと同じアプローチをしました。私が気づいた2つのこと:このラムダL,hb_ebは1バイト短く、.DR2Tデカルト積とさらにいくつかのペアを作成しますが、数字ではなくスペースを節約します。
ジャクベ

@ジャクベありがとう、その.Dトリックは本当にクールです!
FryAmTheEggman

5

Pythonの3、145の 141 130バイト

def f(s):a=[i in"':"for i in s]+[i in".:"for i in s][::-1];return''.join(" '.:"[i+2*j]for i,j in zip([a[-1]]+a,a[-2:len(s)-2:-1]))

説明

golfedソリューションジップの次のプロパティを使用しますzip('ABCD', 'xy') --> Ax By のでzip(a[:l],a[l:])によって置き換えることができるzip(a,a[l:])とその定義を削除することができますl

def f(s):
 l=len(s)-1
 #                ┌───── unfold input string :  123  -> 123456
 #                │                             654
 #  ──────────────┴──────────────────────────────
 a=[i in"':"for i in s]+[i in".:"for i in s][::-1]
 # ─────────┬─────────   ────────────┬───────────
 #          │                        └──── generate the second row and reverse it
 #          └─────────── generate the first row 

 return''.join(" '.:"[i+2*j]for i,j in zip([a[-1]]+a[:l],a[l:-1][::-1]))
 #             ──────┬──────           ─┬    ────────────┬───────────
 #                   │                  │                └──── rotate and create first/second new row :  123456  -> 612345  -> 612
 #                   │                  │                                                                                      543
 #                   │                  └ group pair of the first and second row : 612 -> (6,5),(1,4),(2,3)
 #                   │                                                             543
 #                   └─────────── replace pair by symbol 

結果

>>> f(".'  '.::  :.'. . ::.'  '. . .::'  :.'.")
"' ' .:.''..'.'. ..:' ' .'. ...'''..'.'"
>>> f(".....''''''")
":...  '''':"

最後の3行を1行にセミコロンで区切って置くことで、数バイト節約できます。
mbomb007

4

Pyth、66バイト

KlQJ.nCm@[,1Z,Z1,ZZ,1 1)%Cd5Qjkm@" .':"id2Ccs[:JKhK<JtK>JhK:JtKK)K

ここで試してみてください!

説明

これは3つの部分に分けられます。

  • 入力を1と0のフラット配列に変換します。
  • 回転を行います。
  • ASCIIに変換し直します。

入力を変換する

これはかなり簡単です。各文字は次の方法でマッピングされます。

  ->(0,0)
。->(0,1)
'->(1,0)
:->(1,0)

最初は空白です。
行列の2行を取得するために転置する2タプルのリストを取得し、その後フラット化します。

コード

KlQJ.nCm @ [、1Z、Z1、ZZ、1 1)%Cd5Q#Q =入力

KlQ#行列の幅をKに保存します(後で使用されます)
       m Q#各文字をマップするd
                        %Cd5#5を法とするdのASCIIコード
        @ [、1Z、Z1、ZZ、1 1)#これをルックアップリストのインデックスとして使用
   J.nC#転置、平坦化、Jへの割り当て

回転

マトリックスはフラット配列でJ、マトリックスの幅はKです。ローテーションは次のように説明できます。

J[K] + J[:K-1] + J[K+1:] + J[K-1]

コード

s [:JKhKJhK:JtKK)#J =フラット配列、K =マトリックスの幅

s [)#このリストのすべての結果を連結
  :JKhK#J [K]
       JhK#J [K + 1:]
               :JtKK#J [K-1]

元に戻す

jkm @ "。 ':" id2Cc [)K#[)=上記のステップの結果リスト

              c [)K#2行に分割
             C#2タプルを戻すために転置
  m#各2タプルdをマップ
          id2#dをバイナリとして解釈し、10進数に変換します
   @ "。 ':"#ルックアップ文字列へのインデックスとして使用して、正しい文字を取得します
jk#1つの文字列に結合する


3

Pythonの3、166 154 153 150 146 138の 137 135 132 127バイト

編集:私は、関数の最後にエルワンのPythonの答えzipからの使用を借りてきました。そして、私は自分自身のひねりを加えましたが、反転を使用する彼らのアイデア結局のところ、反転は私の機能にとって良いアイデアではありませんでした。さらにゴルフをするための使用方法を変更しました。移動と直接にさらにゴルフのために(ungolfingは分離のために変更されないままと私の説明では混乱を避けるにために有用があります)[::-1]formatabzipab

編集:Music Interval Solverチャレンジでxnorがこの回答(some number)>>(n)&(2**something-1)から借りましたzip(*[divmod(et cetera, 2) for i in input()])2つのタプルtとを使用することで得られる便利さは気に入っていますが、おそらく、混乱はより良くなるでしょうv

t,v=zip(*[divmod(708>>2*(ord(i)%5)&3,2)for i in input()])
print("".join(" '.:"[i+j*2]for i,j in zip((v[0],*t),(*v[1:],t[-1]))))

ゴルフをしていない:

def rotate_dots(s):
    # dots to 2 by len(s) matrix of 0s and 1s (but transposed)
    t = []
    v = []
    for i in s:
        m = divmod(708 >> 2*(ord(i)%5) & 3, 2)
            # ord(i)%5 of each char in . :' is in range(1,5)
            # so 708>>2 * ord & 3 puts all length-2 01-strings as a number in range(0,4)
            # e.g. ord(":") % 5 == 58 % 5 == 3
            # 708 >> 2*3 & 3 == 0b1011000100 >> 6 & 3 == 0b1011 == 11
            # divmod(11 & 3, 2) == divmod(3, 2) == (1, 1)
            # so, ":" -> (1, 1)
        t.append(m[0])
        v.append(m[1])

    # transposing the matrix and doing the rotations
    a = (v[0], *t)          # a tuple of the first char of the second row 
                            # and every char of the first row except the last char
    b = (v[1:], t[-1])      # and a tuple of every char of the second row except the first
                            # and the last char of the first row

    # matrix to dots
    z = ""
    for i, j in zip(a, b):
        z += " '.:"[i + j*2]    # since the dots are binary
                                # we take " '.:"[their binary value]
    return z

2

ルビー、166 163バイト

->s{a=s.tr(f=" .':",t='0-3').chars.map{|x|sprintf('%02b',x).chars}.transpose;a[1]+=[a[0].pop];a[0]=[a[1].shift]+a[0];a.transpose.map{|x|x.join.to_i 2}.join.tr t,f}

うん... transpose長すぎる。

ここで使用されるトリック:

  • sprintf('%02b',x)変換するには"0""1""2""3""00""01""10"、および"11"それぞれ。驚くべきことに、2番目の引数を最初に整数に変換する必要はありませ

  • ローテーションはを介して行われますがa[1].push a[0].pop;a[0].unshift a[1].shift;、これは少なくとも少し巧妙だと思っていました(Rubyで過度に冗長ではない場合)。とにかく、対称性は審美的に素晴らしいです:P


少しゴルフをすることをお勧めしますか?->s{a=s.tr(f=" .':",'001').chars;b=s.tr(f,'0101').chars;b<<a.pop;([b.shift]+a).zip(b).map{|x|x.join.to_i 2}.join.tr'0-3',f}
マナトワーク

最後に☕が効果を発揮しました。これを朝まで探していました:.map{|x|x.join.to_i 2}.join.tr'0-3',f.map{|x|f[x.join.to_i 2]}*''
manatwork

2

Javascript ES6 125バイト

q=>(n=[...q].map(a=>(S=` .':`).indexOf(a))).map((a,i)=>(i?n[i-1]&2:n[0]&1&&2)|((I=n[i+1])>-1?I&1:n[i]&2&&1)).map(a=>S[a]).join``

各文字を同等の2桁のバイナリにマッピングします

 : becomes 3   11
 ' becomes 2   10
 . becomes 1   01
   becomes 0   00

そして、私はそれらを他のものの上にあると考えています

3212021 becomes
1101010
1010001

それをnに保存します

nの各文字(0〜3)について、その近傍をチェックし、左近傍の最上位ビットを右近傍の最下位ビットに追加します。i == 0(最初の文字)の場合、左隣の上位ビットの代わりに独自の下位ビットを使用します。

n [i + 1]>-1の場合、0、1、2、3を得たことを意味するため、falseの場合、最後の要素にヒットします。

その場合、右隣の下位ビットではなく、キャラクター自身の最高位ビットを使用します

それを.':土地にマップし、その配列を再び結合します


2

MATL40 39バイト

' ''.:'tjw4#mqBGnXKq:QKEh1Kq:K+hv!)XBQ)

オンラインでお試しください! この回答が投稿された後の言語の変更のため、リンクされたバージョンはvペースを戻しました&v

' ''.:'               % pattern string. Will indexed into, twice: first for reading 
                      % the input and then for generating the ouput
t                     % duplicate this string
j                     % input string
w                     % swap
4#m                   % index of ocurrences of input chars in the pattern string
qB                    % subtract 1 and convert to binay. Gives 2-row logical array
GnXKq:QKEh1Kq:K+hv!   % (painfully) build two-column index for rotation
)                     % index into logical array to perform the rotation
XBQ                   % transform each row into 1, 2, 3 or 4
)                     % index into patter string. Implicitly display

1

JavaScript、311バイト

おそらく改善することができます:

a=(s=prompt()).length-1;o=s[0]==":"||s[0]=="."?s[1]==":"||s[1]=="."?":":"'":s[1]==":"||s[1]=="."?".":" ";for(i=1;i<a;i++)o+=s[i-1]=="'"||s[i-1]==":"?s[i+1]=="."||s[i+1]==":"?":":"'":s[i+1]=="."||s[i+1]==":"?".":" ";alert(o+=s[a]==":"||s[a]=="'"?s[a-1]==":"||s[a-1]=="'"?":":"'":s[a-1]==":"||s[a-1]=="'"?".":" ")

たぶん何かを設定しs[i-1]ますか?それはいくつかのバイトを節約できます。
Rɪᴋᴇʀ

と同じs[i+1]
Rɪᴋᴇʀ

1
ES6の矢印関数とルックアップを使用してみてください。<代わりにを使用すると、==かなりのバイト数を節約できます。また、チェックアウトする場合がありますJSでゴルフをするためのヒントES6でゴルフのためのヒント
Downgoat

1
@Downgoatの<代わりに使用できますか==
ジェンスレンダリング

1

JavaScriptの(ES6)、237の 210 204 188 182 178バイト

188バイトのリビジョンで16バイトを保存した@Downgoatの功績

更新:脳波があり、最初の操作を2つの個別の呼び出しではなくs1つのmap呼び出しに減らしました

s=>(r=" .':",a=[],s=[...s].map(c=>(t=('00'+r.indexOf(c).toString(2)).slice(-2),a.push(t[0]),t[1])),a.splice(0,0,s.shift()),s.push(a.pop()),a.map((v,i)=>r[+('0b'+v+s[i])]).join``)

プリティプリント&説明

s => (
  r = " .':", // Map of characters to their (numerical) binary representations (e.g. r[0b10] = "'")
  a = [],     // extra array needed
  // Spread `s` into an array
  s = [...s].map(c => (
    // Map each character to a `0`-padded string representation of a binary number, storing in `t`
    t = ('00' + r.indexOf(c).toString(2)).slice(-2)),
    // Put the first character of `t` into `a`
    a.push(t[0]),
    // Keep the second character for `s`
    t[1]
  )),
  // Put the first character of `s` in the first index of `a`
  a.splice(0,0,s.shift()),
  // Append the last character of `a` to `s`
  s.push(a.pop(),
  // Rejoin the characters, alternating from `a` to `s`, representing the rotated matrix, and map them back to their string representation
  // Use implicit conversion of a binary number string using +'0b<num>'
  a.map((v,i) => r[+('0b' + v + s[i])]).join``
)

1
する:s=>(r=" .':",a=[],s=[...s].map(c=>('00'+r.indexOf(c).toString(2)).slice(-2)).map(n=>(a.push(n[0]),n[1]),a.splice(0,0,s.shift()),s.push(a.pop()),a.map((v,i)=>r[parseInt(v+s[i],2)]).join``)動作しますか?
ダウンゴート

以前にこれに返信しないで申し訳ありません、通知が表示されませんでした-私の開発者ツールは私に「違法文字」例外を与えています
-RevanProdigalKnight

あなたがそれを置くと動作するようになりました-明らかに私がそれをコピーしたとき、ブラウザ開発者ツールには表示されなかったいくつかの余分な目に見えない文字がありました。
-RevanProdigalKnight

1

Perl、144 142 137 131バイト

y/.':/1-3/;s/./sprintf'%02b ',$&/ge;@a=/\b\d/g;@b=(/\d\b/g,pop@a);@a=(shift@b,@a);say map{substr" .':",oct"0b$a[$_]$b[$_]",1}0..@a

-nフラグに追加されたバイト。

Rubyの答えとほぼ同じアルゴリズムですが短いのは... Perlです。

y/.':/1-3/;                         # transliterate [ .':] to [0123]
s/./sprintf'%02b ',$&/ge;           # convert each digit to 2-digit binary
@a=/\b\d/g;                         # grab the 1st digit of each pair
@b=(/\d\b/g,                        # 2nd digit of each pair
pop@a);                             # push the last element of a to b
@a=(shift@b,@a);                    # unshift the first element of b to a
say                                 # output...
map{                                # map over indices of a/b
substr" .':",oct"0b$a[$_]$b[$_]",1  # convert back from binary, find right char
}0..@a                              # @a is length of a

むやみに、@a=(shift@b,@a)はより短いですunshift@a,shift@b

残念ながら、これらは同じ長さです。

y/ .':/0-3/;s/./sprintf'%02b ',$&/ge;
s/./sprintf'%02b ',index" .':",$&/ge;

おかげトンHospel 5バイトのためmsh210バイトのために!


..@a代わりに使用できます..$#aか?(おそらくoct死ぬか、0または何かを返します。私はそれを試していません。)
msh210

スペースを0に変換する必要はありません。とにかくsprintfに対して0と評価されます。また、正規表現内の括弧を取り除きます。全体のマッチが返され何のキャプチャがない場合//g
トンHospel

@ msh210それは確かに機能します。ありがとう!
ドアノブ

@TonHospelありがとう、それらを答えに取り入れました(ただし、明らかにあなたのものはまだ完全に私のものを水から吹き飛ばしています)。
ドアノブ

それsprintfはすっごく長いです。map$_%2,/./gそしてmap$_/2|0,//gほとんど(未テスト)より短くなければならない
トンHospel

0

Python 3、294 287 283バイト

Waaayyyyyyが長すぎますが、いくつかのバイトのゴルフを試みます:

z=input()
x=len(z)
M=[0,1,2,3]
for Q in M:z=z.replace(":'. "[Q],"11100100"[Q*2:Q*2+2])
a=[]
b=[]
for X in range(x):a+=[z[X*2]];b+=[z[X*2+1]]
b=b[1:]+[a.pop()]
c=[b[0]]+a
z=""
for X in range(len(c)):
 y=c[X]+b[X]
 for Q in M:y=y.replace("11100100"[Q*2:Q*2+2],":'. "[Q])
 z+=y
print(z)

0

Lua、139バイト

print(((...):gsub(".",{[" "]="NN@",["."]="YN@",["'"]="NY@",[":"]="YY@"}):gsub("(.)@(.?)","%2%1"):gsub("..",{NN=" ",NY=".",YN="'",YY=":"})))

使用法:

$ lua conveyor.lua ".'  '.::  :.'. . ::.'  '. . .::'  :.'."
' ' .:.''..'.'. ..:' ' .'. ...'''..'.'
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.