°Ê²¼¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¤sed
¤Ç»»¿ô¤ò¹Ô¤Ê¤¦¤â¤¦°ì¤Ä¤ÎÊýË¡¤òÄ󼨤·¤Æ
¤¤¤Þ¤¹¡¥¤³¤Î¾õ¶·¤Ç¤Ï¡¤²æ¡¹¤Ï²Äǽ¤Ê¸Â¤êÂ礤ʿô¤òÄɲ乤ëɬÍפ¬¤¢¤ë¤Î¤Ç¡¤
¤³¤ì¤òÀµ¤·¤¯Áý²Ã¤¹¤ë¤è¤¦¤Ë¼ÂÁõ¤¹¤ë¤³¤È¤ÏÉÔ²Äǽ¤Ç¤·¤ç¤¦(¤½¤·¤Æ¡¤¤ª¤½¤é¤¯
¤³¤Î¥¹¥¯¥ê¥×¥È¤è¤ê·×»»¤¬¤è¤êÊ£»¨¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦)¡¥
¿ô»ú¤òʸ»ú¤Ë³ä¤êÅö¤Æ¤ë¥¢¥×¥í¡¼¥Á¤Ï¡¤sed
¤òÍѤ¤¤¿¥½¥í¥Ð¥ó¤Î¼ÂÁõ
¤Î°ì¼ï¤Ç¤¹¡¥‘a’¤Ï°ì¤Î°Ì¡¤‘b’¤Ï½½¤Î°Ì¤Ê¤É¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥²æ¡¹
¤Ï¡¤°ì¤Î°Ì¤È¤·¤Æ¸½ºß¤Î¹Ô¤Ëʸ»ú¤Î¿ô¤òñ½ã¤ËÄɲä·¡¤½½¤Î°Ì¡¤É´¤Î°Ì¤Ê¤É¤Ë
·«¤ê¾å¤²ÅÁȤµ¤»¤Æ¤¤¤Þ¤¹¡¥
Ä̾ïÄ̤ꡤ¼Â¹Ô»þ¤ÎÁí¿ô¤Ï¥Û¡¼¥ë¥É¶õ´Ö¤ËÊÝ»ý¤µ¤ì¤Þ¤¹¡¥
ºÇ¸å¤Î¹Ô¤Ç¡¤¥½¥í¥Ð¥ó¤ò½½¿Ê¿ô¤Î·Á¼°¤ËÌᤷ¤Æ¤¤¤Þ¤¹¡¥Â¿ÍÍÀ¤Î¤¿¤á¡¤¤³¤ì¤Ï
80¤Îs
¥³¥Þ¥ó¥É¤Ç¤Ï¤Ê¤¯¡¤¥ë¡¼¥×¤òÍѤ¤¤Æ¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹9¡¥ºÇ½é
¤Ë°ì¤Î°Ì¤òÊÑ´¹¤·¡¤‘a’¤ò¿ôÃͤ«¤éºï½ü¤·¤Þ¤¹¡¥¤½¤·¤Æ½½¤Î°Ì¤¬‘a’
¤Ë¤Ê¤ë¤è¤¦¤Ëʸ»ú¤ò²óž¤µ¤»¡¤»Ä¤Ã¤Æ¤¤¤ëʸ»ú¤¬Ìµ¤¯¤Ê¤ë¤Þ¤Ç¤½¤ì¤ò³¤±¤Þ¤¹¡¥
#!/usr/bin/sed -nf
# Add n+1 a's to hold space (+1 is for the newline) s/./a/g H x s/\n/a/
# Do the carry. The t's and b's are not necessary, # but they do speed up the thing t a : a; s/aaaaaaaaaa/b/g; t b; b done : b; s/bbbbbbbbbb/c/g; t c; b done : c; s/cccccccccc/d/g; t d; b done : d; s/dddddddddd/e/g; t e; b done : e; s/eeeeeeeeee/f/g; t f; b done : f; s/ffffffffff/g/g; t g; b done : g; s/gggggggggg/h/g; t h; b done : h; s/hhhhhhhhhh//g
: done $! { h b }
# On the last line, convert back to decimal
: loop /a/! s/[b-h]*/&0/ s/aaaaaaaaa/9/ s/aaaaaaaa/8/ s/aaaaaaa/7/ s/aaaaaa/6/ s/aaaaa/5/ s/aaaa/4/ s/aaa/3/ s/aa/2/ s/a/1/
: next y/bcdefgh/abcdefg/ /[a-h]/ b loop p