Add tags

Add tags to the following comment
sedだと割り算のコストが高すぎるので、他のアルゴリズムでは難しそうです。
乗算+ソートのために内部は2進で計算しています。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sed
s/.*/lol/
: loop
    s/^\([^l]*\)l*o\([lo]*\)\(\n.*\)\?$/\1a\2\3\nx\2o\nx\2o+\2=\nx\2oo+\2=/
    : 2->10
        s/[f-j]/#&/g
        s/[a-j][#l]/\U&/g
        y/AbBcCdDeEfFgGhHiIjJ/bcdefghijabcdefghij/
        s/^#/b/m
        s/#//g
        s/\([a-j]\)[Lo]/\1/
    /[a-j][lo]/ b 2->10
    y/abcdefghij/0123456789/
    : add
        s/\([xo]l*\)l+\([lo]*\)l=/\U\1\E+\2=o/g
        s/X/xl/g
        y/LO/ol/
        s/l+\([lo]*\)o=/+\1=l/g
        s/o+\([lo]*\)\([lo]\)=/+\1=\2/g
        s/+=//g
    t add
    s/^x\([lo]*\)$/\U\1\Eo\1/gm
    y/LO/ll/
    : sort
        s/^\([lo]*\)\n\1$/\1/gm
        s/^\(\([lo]*\)l[lo]*\)\n\(\2o[lo]*\)$/\3\n\1/gm
    t sort
    s/^\(\(\w*\n\)\{99\}\w*\)\n.*$/\1/
/[lo]/ b loop

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...