#!perl -l while(@ARGV){$i=pop;$_=pop;next if!$i&!$_;s/^.//;$i=~/$&/;push@ARGV,substr($_,0,$-[0]),$`,substr($_,$-[0]),$';$r="$&$r";}print$r