in reply to group things?

$ perl -le' my $x = q[-----MMMMM------IIIII----MMM---OOOO---I---MMMM-----]; while ( $x =~ /([^-])/g ) { my $y = $1; pos( $x )--; $x =~ /\G$y+/g and print $-[0] + 1, $-[0] + 1 == $+[0] ? "" : "-$+ +[0]", ":$y"; } ' 6-10:M 17-21:I 26-28:M 32-35:O 39:I 43-46:M