while(s/(\w+?)(\1+)//) { print $` if $`; my @L = split "(?=$1)", $&; printf "%s repeated %i time%s\n", $1, $#L+1, $#L ? 's' : '' }