Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Longest possible run of a single character

by BrowserUk (Patriarch)
on May 22, 2006 at 21:41 UTC ( [id://551044]=note: print w/replies, xml ) Need Help??


in reply to Longest possible run of a single character

Sorting isn't a particularly efficient way of finding the maximum length, but unless your strings are huge, it probably won't matter too much.

print +( sort{ length $b <=> length $a } $s =~ m[((.)\2+)]g )[ 0 ];;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://551044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2024-03-28 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found