sub min_chunks {
    my $w = "$_[0]:$_[1]";
    my $c = 0;
    $c++ while ( $w =~ s{(\w+)([^:]*:.*)\1}
                        {'.'x length($1).$2.'.'x length($1)}e
    );
    $c;
}

