in reply to Block Search

My golf solution for this:
$s1 = 'abbbcddddfegrgrgddeeeeedd'; print"$s1\n\n";($s2=$s1)=~s/((.)\2*)/$1,/g;map{$i=index($s1,$_);$l=len +gth;print '-'x$i,$_,'-'x(length($s1)-$i-$l),"\n";substr($s1,$i,$l,','x$l);}sort{ +length$b <=>length$a}split(/,/,$s2);
update: shorter now

Replies are listed 'Best First'.
Re2: Block Search
by blakem (Monsignor) on Oct 04, 2002 at 21:22 UTC
    fore! 136 chars
    #!/usr/bin/perl -wT use strict; my $s1 = 'abbbcddddfegrgrgddeeeeedd'; # 1 2 3 4 5 6 #2345678901234567890123456789012345678901234567890123456789012345678 print$s1.$/x2;push(@;,[$+[0]-$+[1],"-"x($+[1]-1).$&."-"x(length($s1) -$+[0])])while$s1=~/(.)\1*/g;print$$_[1].$/for sort{$$b[0]-$$a[0]}@;

    -Blake

      wow! ++blakem ... Can you break it down for me?