$_=<>; push@_,$1<$2?$1..$2:reverse$2..$1 while/(?=(.)(.))/g; $_=join '',@_; print s/(.)\1+/$1x~-length$&/ger
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page