#!perl -p0 s?\w?$x[@x]=$&;(grep$x[-2-$_]eq$&,0..9)[0]//$&?eg
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page