On Mon, Dec 10, 2001 at 10:57:06AM -0500, Ronald J Kimball wrote:
> On Mon, Dec 10, 2001 at 04:36:26PM +0100, BooK wrote:
> > You mean (supposing the code is in $_, and $score is in $s):
> > 
> > $o="\xff";for(split//){$s++if($_>$o);$o=$_};print$s
> > 
> > Mmm. This might not work (or compile): I do not have a perl here.
> > (I tried other things to obfuscate the algorithm, and then I remembered
> > I was at work. Oops.)
> 
> You're using a numeric comparison on strings.  :)

P.S.  I should have added, your code works perfectly after changing > to
gt.

Although perhaps it should be ge, with a corresponding change from < to <=
in Alistair's original and lt to le in my code, to count adjacent identical
characters as sorted.

Ronald

Reply via email to