Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: substrings that consist of repeating characters

by Tux (Canon)
on Sep 29, 2020 at 11:09 UTC ( [id://11122321]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use 5.18.0;
    use warnings;
    ...
    
    $subs{$_}++ for grep { length >= 2 } split m/,/ => ($string =~ s/([ACG
    +T])\K(?!\1)/,/gr);
    printf "%5d %3d %s\n", $subs{$_->[1]}, @$_ for sort { $b->[0] <=> $a->
    +[0] || $a->[1] cmp $b->[1] } map {[ length, $_ ]} keys %subs;
    
  2. or download this
        1   6 CCCCCC
        1   4 GGGG
    ...
        2   2 AA
        2   2 GG
        5   2 TT
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-29 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found