sub f { my $txt = join('', sort(split //,shift)); $txt =~ s/(.)\1+/$1/g; return length($txt); }