$string =~ s/(([A-Z])\2+)/lc $1/eg;