Unicode UTFコンバーター


17

目標は、UTF FAQに記載されている公式のUnicodeエンコーディング間で完全に準拠したコンバーターを作成することです。これがユニコードに集中していることを考えると、関連するエンコーディング(おそらく、APLでプログラムしない限りUTF-8になる)の可能な限り最高のバイトカウントで回答を受け入れます。長い投稿をおa びしますが、その多くは公式仕様(pdf、セクション3.9 D90-D92)、またはWikipediaでもアクセスできるエンコードについて説明しています。

仕様書

選択した言語がいつでも要件を完全に満たせない場合は、指定されたルールの精神を維持するものに置き換えてください。例えば。すべての言語に組み込みの配列、関数などがあるわけではありません。

  • 文字列ライブラリ/関数の使用、またはライブラリ/関数のエンコードはありません。このコードの目的は、ビット/バイト操作を使用してコンバーターを実装することです。ただし、文字列自体を文字またはバイト配列として使用することは許可されています。ああ、また、変換を実行するOS呼び出しもありません。

  • コンバーターは、エンコードされた入力文字列を表すバイト配列、および数値として表される「入力」および「出力」エンコーディングの3つのパラメーターを受け取る関数です。UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, and UTF32LE0から6までの番号をこの順序で任意に割り当てます。数があるかどうかをチェックする必要はありません< 0> 6、私たちはこれらのパラメータが正しいと仮定しますが。コンバーターは、目的の出力エンコーディングで有効なバイト配列を返します。

  • ヌル文字(U+0000)をストリングターミネーターとして使用します。この後は何でも構いません。入力配列のどこかにヌル文字があると想定しますので、境界チェックを行う必要はありません。

  • FAQのとおり、入力バイト配列が宣言されたエンコーディングに対して無効な場合、エラーを通知する必要があります。次のいずれかの方法でこれを行います:プログラムをクラッシュさせる、例外をスローする、nullを返す、または最初の4バイトがすべて0である配列を返す(U+0000すべてのエンコードで認識できるように)。

エンコーディング

公式の仕様に従う必要がありますが、ウィキペディアはエンコーディングの適切な(そして正しいと思う限り)説明を提供します。完全を期すためにここで要約します。UTF-16およびUTF-32には、エンディアンのバリエーションがあることに注意してください。

UTF-32、UTF-32LE、UTF-32BE

最も単純なエンコード、各コードポイントは、その数値に等しい4バイトでエンコードされます。LE / BEは、エンディアン(リトルエンディアン/ビッグエンディアン)を表します。

UTF-16、UTF-16LE、UTF-16BE

からのコードポイントU+0000 - U+FFFFは、その数値に等しい2バイトでエンコードされます。より大きな値は、から予約された値であるサロゲートのペアを使用してエンコードされますU+D800 - U+DFFF。したがって、より大きいポイントをエンコードするにU+FFFFは、次のアルゴリズムを使用できます(Wikipediaから恥知らずにコピーされます)。

  • 0x010000がコードポイントから差し引かれ、0..0x0FFFFFの範囲の20ビット数が残ります。
  • 上位10ビット(0..0x03FFの範囲の数値)が0xD800に追加され、最初のコードユニットまたはリードサロゲートが与えられます。これは0xD800..0xDBFF [...]の範囲になります。
  • 下位10ビット(0..0x03FFの範囲内)が0xDC00に追加され、2番目のコードユニットまたはトレイルサロゲートが与えられます。これは0xDC00..0xDFFF [...]の範囲になります。

UTF-8

からのコードポイントU+0000 - U+007Fは、その数値に等しい1バイトとしてエンコードされます。U+0080 - U+07FF彼らは次のようにエンコードされている110xxxxx 10xxxxxxU+0800 - U+FFFFである1110xxxx 10xxxxxx 10xxxxxx、高い値です11110xxx 10xxxxxx 10xxxxxx 10xxxxxxxさんは、コードポイントの数値からのビットです。

BOM

バイト順マーク(BOM、U+FEFF)は、エンディアンを示す最初のコードポイントとして使用されます。BOMに関するFAQガイドラインに従って、BOMは次のように使用されUTF-8, UTF-16 and UTF-32ます。UTF-16またはにBOMがない場合、UTF-32ビッグエンディアンと見なされます。BOM はに表示しないでくださいUTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE

無効なUTFを引き起こす一般的な落とし穴

さまざまなことが原因で、バイトシーケンスが無効なUTFになる場合があります。

  • UTF-8およびUTF-32:代理コードポイント(U+D800 - U+DFFF)、またはより大きいコードポイントを直接エンコードしますU+10FFFF
  • UTF-8:多くの無効なバイトシーケンス。
  • UTF-16:ペアになっていない、またはペアになっていないサロゲート。
  • BOM:エンコードセクションで指定されているとおりに使用する必要があります。出力UTF-16またはUTF-32(固有のエンディアンが指定されていない)出力を選択することはできますが、リトルエンディアンではBOMを含める必要があることに注意してください。

非文字および未割り当てコードポイント(両方ともサロゲートとは異なる)は、通常の文字のように扱われることに注意してください。


「文字列ライブラリ/関数の使用、またはライブラリ/関数のエンコードはありません。」実際のビルトインはどうですか。APLでは、''⎕R''⍠'InEnc' 'UTF16BE' 'OutEnc' 'UTF8-BOM'
アダム

2
@NBZこの課題のポイントは、それらが提供する動作を実装することであるため、これらは許可されません。
DPenner1

回答者への注意:この質問は多かれ少なかれ放棄しましたが、最近の関心が高まっていることを考えると、今後数時間かけて答えを確認することになります。
DPenner1

回答:


3

C ++、(UTF-8)971バイト

#include<cstdint>
using u=uint8_t;using U=uint32_t;U i,o,x,b,m;U R(u*&p){x=*p++;if(!i){m=0;while(128>>m&x)++m;if(m>1)for(x&=127>>m;--m;)x=x<<6|((*p&192)-128?~0:*p++&63);return m?x=~0:x;}else if(i<3){x<<=8;x+=*p++;}else if(i<4){x+=*p++<<8;}else if(i<6){x<<=24;x+=*p++<<16;x+=*p++<<8;x+=*p++;}else{x+=*p++<<8;x+=*p++<<16;x+=*p++<<24;}return x;}U r(u*&p){U x0=R(p);if(i&&i<4&&x>>10==54)x=R(p)>>10==55?(x0<<10)+x-56613888:~0;if(!b++){if(x==65279)if(!i||i%3==1)r(p);else x=~0;else if(x==65534&&i==1)i=3,r(p);else if(x==4294836224&&i==4)i=6,r(p);}return x>1114111||x>>11==27?x=~0:x;}void w(U x,u*&p){if(!o){if(x<128)*p++=x;else{for(m=0;~63<<m&x;m+=6);for(*p++=~127>>m/6|x>>m;m;)*p++=128|x>>(m-=6)&63;}}else if(o<4&&x>65535)x-=65536,w(55296|x>>10,p),w(56320|x&1023,p);else if(o<3)*p++=x>>8,*p++=x;else if(o<4)*p++=x,*p++=x>>8;else if(o<6)*p++=x>>24,*p++=x>>16,*p++=x>>8,*p++=x;else*p++=x,*p++=x>>8,*p++=x>>16,*p++=x>>24;}int t(u*&p,u*&q){for(b=0,x=1;U(x+x);)w(r(p),q);return x;}

以下の読み取り可能なプログラムは、次のPerlコマンドでフィルタリングすることにより、上記の形式に凝縮できます。

perl -p0 -e 's!//.*!!g;s/\s+/ /g;s/ \B|\B //g;s/0x[\da-f]+/hex($&)/ige;s/#include<[^<>]+>/\n$&\n/g;s/^\n+//mg'

上記のコマンド

  • コメントを削除します
  • 不要な空白を削除します
  • 16進数リテラルを10進数に変換します
  • #include行の周りの改行を復元します

読み取り可能なコード

#include <cstdint>
using u = uint8_t;
using U = uint32_t;

U   i,                          // input encoding
    o,                          // output encoding
    x,                          // last read value
    b,                          // char count(BOM only valid when b==0)
    m;                          // temporary variable for measuring UTF-8

//   Encodings:
// 0 UTF-8
// 1 UTF-16
// 2 UTF-16BE
// 3 UTF-16LE
// 4 UTF-32
// 5 UTF-32BE
// 6 UTF-32LE

// Read a character or UTF-16 surrogate
U R(u*& p) {
    x = *p++;
    if (!i) { // UTF-8
        m=0; while (128>>m&x) ++m; // how many bytes?
        if (m>1) for (x&=127>>m; --m; ) x = x<<6 | ((*p&192)-128?~0:*p++&63);
        return m ? x=~0 : x;
    } else if (i<3) { // UTF-16, UTF-16BE
        x<<=8; x+=*p++;
    } else if (i<4) { // UTF-16LE
        x+=*p++<<8;
    } else if (i<6) { // UTF-32, UTF-32BE
        x<<=24; x+=*p++<<16; x+=*p++<<8; x+=*p++;
    } else { // UTF-32LE
        x+=*p++<<8; x+=*p++<<16; x+=*p++<<24;
    }
    return x;
}

// Read a character, combining surrogates, processing BOM, and checking range
U r(u*& p) {
    U x0 = R(p);
    if (i && i<4 && x>>10==54)
        x = R(p)>>10==55 ? (x0<<10)+x-56613888: ~0; // 56613888 == 0xd800<<10 + 0xdc00 - 0x10000
    if (!b++) {                 // first char - is it BOM?
        if (x==0xFEFF)
            if (!i || i%3==1)
                r(p); // BOM in UTF-8 or UTF-16 or UTF-32 - ignore, and read next char
            else
                x = ~0; // not allowed in these modes
        else if (x==0xFFFE && i==1)
            i=3,r(p); // reversed BOM in UTF-16 - change to little-endian, and read next char
        else if (x==0xFFFE0000 && i==4)
            i=6,r(p); // reversed BOM in UTF-32 - change to little-endian, and read next char
    }
    return x>0x10ffff || x>>11==27 ? x=~0 : x;
}


// Write character(assumed in-range)
void w(U x, u*& p) {
    if (!o) { // UTF-8
        if (x<128) *p++=x;        // ASCII
        else {
            for (m=0; ~63<<m&x; m+=6); // how many bits?
            for (*p++=~127>>m/6|x>>m; m; ) *p++ = 128|x>>(m-=6)&63;
        }
    } else if (o<4 && x>65535)  // UTF-16 surrogate
        x-=65536, w(0xD800|x>>10,p), w(0xDC00|x&0x3FF,p);
    else if (o<3)  // UTF-16, UTF-16BE
        *p++=x>>8, *p++=x;
    else if (o<4)  // UTF-16LE
        *p++=x, *p++=x>>8;
    else if (o<6)  // UTF-32, UTF-32BE
        *p++=x>>24, *p++=x>>16, *p++=x>>8, *p++=x;
    else  // UTF-32LE
        *p++=x, *p++=x>>8, *p++=x>>16, *p++=x>>24;
}

// Transcode
int t(u*& p, u*& q)                  // input, output
{
    for (b=0,x=1;U(x+x);)    // exit condition is true only for x==-x, i.e. 0 and ~0
        w(r(p),q);
    return x;
}

呼び出される関数は、t()グローバル変数に渡された入力及び出力符号化と、iそしてoそれぞれ、およびp入力のバイトを指している必要があり、NULLで終了すること。 q上書きされる出力バッファを指し、結果に対して十分な大きさでなければなりません -バッファオーバーランを回避する試みはありません。

コードのコメントが十分に説明的であることを願っています-そのうちの1つが難解すぎるかどうかを以下に尋ねてください(ただし、最初に努力してください!)。

この答えを開発しながら、かなりのテストスイートをコンパイルしました。他の参加者の利益のために、および要件の私の解釈を文書化するために、以下にそれを含めます。

テスト機能

#include <vector>
#include <iostream>

std::ostream& operator<<(std::ostream& out, const std::vector<u>& v)
{
    out << "{ ";
    for (int i: v) out << i << " ";
    out << "}";
    return out;
}

int test_read(int encoding, std::vector<u> input, U expected)
{
    b = 0;
    i = encoding;
    auto d = input.data();
    U actual = r(d);
    if (actual == expected) return 0;
    std::cerr << std::hex << "Decoding " << encoding << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

int test_write(int encoding, U input, std::vector<u> expected)
{
    o = encoding;
    u buf[20], *p = buf;
    w(input, p);
    std::vector<u> actual(buf,p);
    if (expected == actual) return 0;
    std::cerr << std::hex << "Encoding " << encoding << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

int test_transcode(int ienc, std::vector<u> input, int oenc, std::vector<u> expected)
{
    b = 0;
    i = ienc; o = oenc;
    u buf[200], *p = buf, *d = input.data();
    int result = t(d, p);
    std::vector<u> actual(buf,p);
    if (result ? expected.empty() : expected == actual) return 0;
    std::cerr << std::hex << "Encoding " << ienc << " to " << oenc << "; " << input << " gave " << actual
              << " instead of " << expected << std::endl;
    return 1;
}

テストスイート

static const U FAIL = ~0;
int main() {
    int e = 0;                        // error count
    // UTF-8
    e += test_read(0, { 128 }, FAIL); // unexpected continuation
    e += test_read(0, { 128, 1 }, FAIL);
    e += test_read(0, { 128, 128 }, FAIL);
    e += test_read(0, { 192, 192 }, FAIL); // start without continuation
    e += test_read(0, { 192, 0 }, FAIL);
    e += test_read(0, { 224, 0 }, FAIL);
    e += test_read(0, { 224, 192 }, FAIL);
    e += test_read(0, { 0xf4, 0x90, 128, 128 }, FAIL); // Unicode maximum+1

    e += test_read(0, { 127 }, 127);
    e += test_read(0, { 192, 129 }, 1); // We accept overlong UTF-8
    e += test_read(0, { 0xc2, 128 }, 128);
    e += test_read(0, { 224, 128, 129 }, 1);
    e += test_read(0, { 0xef, 128, 128 }, 0xF000);
    e += test_read(0, { 0xef, 191, 191 }, 0xFFFF);
    e += test_read(0, { 0xf4, 128, 128, 128 }, 0x100000);
    e += test_read(0, { 0xf4, 0x8f, 191, 191 }, 0x10FFFF); // Unicode maximum

    e += test_read(0, { 0xEF, 0xBB, 0xBF, 127 }, 127); // byte-order mark

    e += test_write(0, 0, { 0 });
    e += test_write(0, 127, { 127 });
    e += test_write(0, 128, { 0xc2, 128 });
    e += test_write(0, 255, { 0xc3, 191 });
    e += test_write(0, 0xFFFF, { 0xef, 191, 191 });
    e += test_write(0, 0x10FFFF, { 0xf4, 0x8f, 191, 191 });

    // UTF-16
    e += test_read(1, { 0, 1 }, 1);
    e += test_read(1, { 0xd8, 0, 0xdc, 1 }, 0x10001);
    e += test_read(1, { 0xdb, 0xff, 0xdf, 0xff }, 0x10ffff);

    e += test_read(1, { 0xd8, 0, 0xd8, 1 }, FAIL); // mismatched surrogate
    e += test_read(1, { 0xd8, 0, 0, 1 }, FAIL); // mismatched surrogate
    e += test_read(1, { 0xdc, 0 }, FAIL);

    e += test_write(1, 1, { 0, 1 });
    e += test_write(1, 256, { 1, 0 });
    e += test_write(1, 0xffff, { 255, 255 });
    e += test_write(1, 0x10001, { 0xd8, 0, 0xdc, 1 });
    e += test_write(1, 0x10ffff, { 0xdb, 0xff, 0xdf, 0xff });

    // UTF-16LE
    e += test_write(3, 1, { 1, 0 });
    e += test_write(3, 256, { 0, 1 });
    e += test_write(3, 0x10001, { 0, 0xd8, 1, 0xdc });
    e += test_write(3, 0x10fffe, { 0xff, 0xdb, 0xfe, 0xdf });

    // UTF-16 byte-order mark
    e += test_read(1, { 0xFE, 0xFF, 0x0, 1 }, 1); // byte-order mark
    e += test_read(1, { 0xFF, 0xFE, 1, 0x0 }, 1); // reversed byte-order mark
    // disallowed byte-order marks
    e += test_read(2, { 0xFE, 0xFF }, FAIL);
    e += test_read(3, { 0xFF, 0xFE }, FAIL);
    // reversed byte-order mark is an unassigned character - to be treated like regular character, according to question
    e += test_read(2, { 0xFF, 0xFE }, 0xfffe);
    e += test_read(3, { 0xFE, 0xFF }, 0xfffe);

    // UTF-32
    e += test_read(4, { 0, 0, 0, 1 }, 1);
    e += test_read(4, { 1, 0, 0, 0 }, FAIL);
    e += test_write(4, 1, { 0, 0, 0, 1 });
    e += test_write(4, 0x10203, { 0, 1, 2, 3 });

    // UTF-32LE
    e += test_read(6, { 0, 0, 0, 1 }, FAIL);
    e += test_read(6, { 1, 0, 0, 0 }, 1);

    // UTF-32 byte-order mark
    e += test_read(4, { 0, 0, 0xFE, 0xFF,  0, 0, 0, 1 }, 1); // byte-order mark
    e += test_read(4, { 0xFF, 0xFE, 0, 0,  1, 0, 0, 0 }, 1); // reversed byte-order mark
    // disallowed byte-order marks
    e += test_read(5, { 0, 0, 0xFE, 0xFF }, FAIL);
    e += test_read(5, { 0xFF, 0xFE, 0, 0 }, FAIL);
    e += test_read(6, { 0, 0, 0xFE, 0xFF }, FAIL);
    e += test_read(6, { 0xFF, 0xFE, 0, 0 }, FAIL);

    e += test_transcode(1, { 1, 2, 0xFE, 0xFF, 0, 0 }, // That's not a BOM; it's a zwnj when not the first char
                        1, { 1, 2, 0xFE, 0xFF, 0, 0 });
    e += test_transcode(1, { 0xFF, 0xFE, 1, 2, 0, 0 }, // reversed byte-order mark implies little-endian
                        1, { 2, 1, 0, 0 });
    e += test_transcode(4, { 0xFF, 0xFE, 0, 0, 1, 2, 0, 0, 0, 0 }, // reversed BOM means little-endian
                        4, { 0, 0, 2, 1, 0, 0, 0, 0 });
    e += test_transcode(1, { 0xdb, 0xff, 0xdf, 0xff, 0, 0 }, // U+10ffff UTF-16 to UTF-8
                        0, { 0xf4, 0x8f, 191, 191, 0 });

    return e;
}

Dang .. C ++はPythonを打ち負かしました。
TickTock

5

Python-1367 UTF-8文字

よし!これは、すべての仕様を理解して実装するのに膨大な作業を要したため、非常に難しい質問でしたが、私は正しい実装を持っていると思います。

O,P,Q,R=65536,128,b'\xff\xfe\x00\x00',63
def A(x,y):assert x;return y
def B(x):
    o,c=[],0
    for b in x:
        if c:c,v=c-1,A(127<b<192,v<<6)|(b-P)
        else:
            c,v=(b>127)+(b>223)+(b>239),b
            if b>127:v=A(191<b<248,b&(R>>c))
        o+=[v][c:]
    return o[o[0]in(65279,O-2):]
def C(k):
    def o(x,s=None):
        for a,b in zip(x[k::2],x[1-k::2]):
            d=a|(b<<8)
            if s!=None:yield(A(56319<d<57344,d-56320)|(s<<10))+O;s=None
            elif 55295<d<57344:s=A(s<1024,d-55296)
            else:yield d
    return o
def D(x):n=(2,3,1)[[Q[:2],Q[1::-1],x[:2]].index(x[:2])];return C(n&1)(x[n&2:])
E=lambda a,b,c,d:lambda x:[L|(l<<8)|(m<<16) for L,l,m in zip(x[a::4],x[b::4],x[c::4])]
def F(x):n,m=((1,4),(-1,4),(-1,0))[[Q,Q[::-1],x[:4]].index(x[:4])];return E(*range(4)[::n])(x[m:])
S=lambda x,s=0,a=255:(x>>s)&a
G=lambda e:(e,)if e<P else(192|S(e,6),P|(e&R))if e<2048 else(224|S(e,12),P|S(e,6,R),P|(e&R))if e<O else(240|S(e,18),P|S(e,12,R),P|S(e,6,R),P|(e&R))
H=lambda e:(S(e,8),S(e))if e<O else(216|S(e-O,18),S(e-O,10),220+S((e-O)&1023,8),S(e-O))
I=lambda e:(S(e),S(e,8))if e<O else(S(e-O,10),216|S(e-O,18),S(e-O),220+S((e-O)&1023,8))
J=lambda e:(S(e,24),S(e,16),S(e,8),S(e))
K=lambda e:(S(e),S(e,8),S(e,16),S(e,24))
convert=lambda d,i,o:bytes(sum(map(L[o],N(list(M[i](d)))),()))if d else d
L,M=[G,H,H,I,J,J,K],[B,D,C(1),C(0),F,E(3,2,1,0),E(0,1,2,3)]
N=lambda d:[A(-1<x<1114112 and x&~2047!=55296,x)for x in d]

convertデータ「バイト」オブジェクト、入力ID、および出力IDを受け取る関数です。動作しているようです-エンコーディングで指定されていない場合、PythonはBOMの使用法が少し壊れているように見えるので、Pythonの組み込みエンコーディングを使用してモード1および4をテストすることはできません。

楽しい事実:サイズも555 16または10101010101 2です。

デコード用に773文字、エンコード用に452文字、検証用に59文字、その他の部分に83文字。


@TrangOul:通常、些細な編集(言語タグ付けなど)は嫌われています。
ザックゲイツ


その質問/回答は、コミュニティのコンセンサスを示していません。ネットワーク全体で、このような些細な編集は嫌われています。コンテンツまたは形式を明確に改善しない限り、<1000または> 1000担当者のユーザーはこれらの編集を行わないでください。言語タグ、単一単語の修正/変更などの編集を控えることをお勧めします。@ cat
Zach Gates

私は:-(サイズはもはや0x555だと思いませんしかし、あなたは近いインデントのための1つのスペースを使用しての標準のPython -ゴルフのヒントを使用してしまうかもしれません。。
トビースパイツ

@TobySpeight現時点では0x557です、あなたは正しいです。実際、タブを使用しました。タブは投稿用にスペースに変換する必要がありましたが、それでも1文字としてカウントされます。チャンスがあれば他の方法でいくつかのキャラクターを剃ることができるかどうかを見に行きます。
セルスケッグス

4

Python 3、1138バイト(UTF-8)

海外旅行の14時間であることが判明し、それはとても素晴らしいゴルフチャレンジ仕上げるための機会...

変換関数はC()です。これは、呼び出しu()v()およびw()デコードするために、およびU()V()、およびW()をそれぞれ符号化する、UTF-8、-16及び-32、。どのエンコーダーもBOMを出力しませんが、すべてのデコーダーがBOMを正しく処理します。エラー条件により例外が発生します(通常ZeroDivisionError、「突然」機能のおかげですE())。

from struct import*
l=len
j=''.join
b=lambda c:[*bin(c)[2:]]
P,Q,i,o,z,Z='HI10><'
B=65279
O,F,H,L,X=1024,65536,55296,56320,57344
E=lambda:1/0
R=lambda y,e,c,n:unpack(([[z,Z][y[:n]==pack(Z+c,B)],e][l(e)])+c*(l(y)//n),y)
S=lambda d,e:B!=d[0]and d or e and E()or d[1:]
def u(y,d=(),p=0):
 while p<l(y):
  q=b(y[p])
  if l(q)>7:
   x=q.index(o);C=1<x<5and q[x+1:]or E();X=x+p;X>l(y)>E();p+=1
   while p<X:q=b(y[p]);C=l(q)>7and(i,o==q[:2])and(*C,*q[2:])or E();p+=1
   d=*d,int(j(C),2)
  else:d=*d,y[p];p+=1
 return S(d,0)
def T(p):
 q=b(p);C=()
 while l(q)not in(7,11,16,21):q=o,*q
 while l(q)>6:C=int(i+o+j(q[-6:]),2),*C;q=q[:-6]
 return bytes(p<128and[p]or[int(i*(7-l(q))+o+j(q),2),*C])
U=lambda c:b''.join(map(T,c))
def v(y,e=''):
 c=R(y,e,P,2);d=[];n=0
 while n<l(c)-1:h,a=c[n:n+2];D=[(h,a),(F+(h-H)*O+a-L,)][H<=h<L<=a<X];M=3-l(D);n+=M;d+=D[:M]
 if n<l(c):d=*d,c[n]
 return S(d,e)
V=lambda c,e=z:W(sum(map(lambda p:([H+(p-F)//O,L+(p-F)%O],[p])[p<F],c),[]),e,P)
w=lambda y,e='':S(R(y,e,Q,4),e)
W=lambda c,e=z,C=Q:pack(e+C*l(c),*c)
K=(u,U),(v,V),(v,V,z),(v,V,Z),(w,W),(w,W,z),(w,W,Z)
def C(y,f,t):f,_,*a=K[f];_,t,*b=K[t];return t(f(y,*a),*b)
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.