#my @chars = grep !$seen{$_}++, $text =~ /./g;
my @chars = 'a'..'z';
my ($re) = map qr/$_/,
join '|',
map "(?<=${_}{3})$_+",
map quotemeta,
@chars;
$text =~ s/$re//g;
####
#my @chars = grep !$seen{$_}++, $text =~ /./g;
my @chars = 'a'..'z';
my ($re) = map qr/$_/,
join '|',
map "${_}{4,}",
map quotemeta,
@chars;
$text =~ s/($re)/substr($1,0,3)/eg;
####
#my @chars = grep !$seen{$_}++, $text =~ /./g;
my @chars = 'a'..'z';
my ($re) = map qr/$_/,
join '|',
map "${_}{4,}",
map quotemeta,
@chars;
$text =~ s/$re/substr($text,$-[0],3)/eg;