I would try dividing the letters in buckets( like AADEFFVV -> {A=>2,D=>1,E=>1,F=>2,V=>2} and then try to make the maximum combinations, if I get it right, the maximum for a given string is its length/4 so my string here has a maximum of 2 sets, then, with this upper bound in mind I would try make 2 sets, if I can't, try 1 and on..until I find a combination that works and this one will be for sure the maximum possible for this string.