#!perl -l $_="@ARGV";s/($&)(.*)/ $2 $1/while s/^.//;y/ //d;print |
Hitting the wall?
#!perl -l $_=pop;($i=pop)=~s#.#s/($&)(.*)/ $2 $1/#ge;y/ //d;print |
Eight strokes, and it doesn't move me up even one place in the rankings?!
#!perl -l
@i=pop;$_=pop;
s#.#@i=map{/$&/?($`,$',$&):$_}@i#ge;
print@i
|
I guess this is a better algorithm!
#!perl -l
($_,@i)=@ARGV;
while(/./g){
@i=map{/$&/?($`,$',$&):$_}@i;
}
print@i
|
#!perl -l
sub n{
if(my$i=pop){
s/.?/pop/e;
my$n=$&;
$i=~s/(.*)$n//;
n($1).n($i).$n}
}
print n(@ARGV)
|