Found the extra space, '#!perl '... stupid space after the 'l'...
#!perl
sub p{if(my$t=pop){$p=~s/^\w//;my$c=$&;$t=~/$c/;my$l=$`;my$r=$';p($l);p($r);$a.=$c}}$p=pop;print p(pop),$/
|
just noticed 2 extra chars..
#!perl
sub p{if(my$t=pop){$p=~s/^\w//;my$c=$&;$t=~/$c/;my$l=$`;my$r=$';p($l);p($r);$a.=$c}}$p=pop;print p(pop),$/
|
changed thinking.. getting better..
#!perl
sub p{if(my$t=pop){$p=~s/^\w//;my$c=$&;$t=~/$c/;my$l=$`;my$r=$';p($l);p($r);$a.=$c}}$p=pop;p(pop);print$a,$/
|
Just another idea I had at the last minute.. just not enough time to tweak with it...
#!perl
$i=pop;$_[0]=pop;
while(@_){$p=pop@_;
if($i=~s/\w//){
if($p=~/$&/){($&=~/$p/)?$a.=$p:push@_,$&,$',$`}
else{$a.=$p;$i=$&.$i}}else{$a.=$p}
}print$a,$/
|
gotta work on it some more... but wanted to get something in...
#!perl
$p=pop;$a{$k=0}=pop;while($p=~/(\w)/g){$p=~s/$+//;for(keys%a){if($a{$_}=~/$+/){$k=$_}}$a{$k}=~/$+/;$l=$`;$r=$';if($l){$a{$k}=~s/$l//;$a{$k*2+1}=$l}if($r){$a{$k}=~s/$r//;$a{$k*2+2}=$r}}p(0);print$/;sub p{my$p=pop;if($a{$p*2+1}){p($p*2+1)}if($a{$p*2+2}){p($p*2+2)}print$a{$p}}
|