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 ];;
In reply to Re: Longest possible run of a single character
by BrowserUk
in thread Longest possible run of a single character
by srdst13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |