stable partition by emoken

s/$/%#@/
:
/^.%/{s/\(.\).\(.*\)#\(.*\)@/\2\1\3/;q} 
h
/^\(.\)\1\(.*\)@/{s//\1\2\1@/;b}
s/\(..\).*/\1/
:1
/ /{G
s/. \n\(.\)\(.\)\(.*\)\(#\)\| .\n\(.\)\(.\)\(.*\)$/\5\7\6\1\3\2\4/
b}
y|!,./123456789:abcdefghijklmnoprstuvwy| !,./123456789:abcdefghijklmnoprstuvw|
b1

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top