sub f{pop=~/([^0])(.*)(?!\1)(.)(.*)\3(?{push@_,"$1$3$3 $2$4$'"})^/;my@s=0;$s[$`-$s+f("$'")]=/ /for@_;$#s}print f<>