[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: SV: [FWP] Can it be funner?



On Wed, 23 Jun 1999, Ronald J Kimball wrote:
> On Wed, Jun 23, 1999 at 05:10:34PM -0500, Tushar Samant wrote:
> > On Wed, 23 Jun 1999 patrik.grip-jansson@vv.se wrote:
>
> > > I believe the fun factor is slightly higher in this version;
> > > 
> > > $_="aaabbbbccaaajjjcccooaaabbbbjjjjjaeefcccooaaabbbbjjaajj";
> > > 
> > > for($n=0;/(.{$n,}).*\1/;$n=length($1)+1){$s=$1;};
> > > 
> > > print "$s\n";
> > > 
> > > It could probably do with some further obfuscation!
> > 
> > This specific code doesn't seem to work, though I can see what you
> > *meant*.
> 
> It seemed to work for me.  Could you be more specific about how it doesn't
> work?

I think I misread the problem--I thought the goal was to find the
longest "monotonous" substring. Now I see what longest "repeating"
substring means. The code is indeed correct.

My bad...

--
Tushar Samant
~
~
:wq


==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org