The question goes like this-
How many strings can be generated by permuting the characters of “abbbbcccdeff” such that there are only 3 mismatchings and the rest 9 are same ?
Obviously, If the string was having only distinct characters(like-“abcdefghijkl“) then the answer would have been- 2*(12C9)=440 strings[as there are 12 characters and 9 of them have to be same]. I can calculate this for strings having distinct characters only, but I am failing to generalise this for strings with repeating characters.
I can manually find all pairs,but this method is very time-consuming,like-for the case of- “abbbcc” there comes a total of 12 such strings . These are-
Where I am failing?
I need a quick solution(some kind of generalised formula) instead of counting it manually
There is $1$ letter with $4$ occurrences, $1$ letter with $3$ occurrences, $1$ letter with $2$ occurrences and $3$ letters with $1$ occurrence. Thus the number of triples of distinct letters is
Each of these can be permuted in $2$ ways, for a total of $2\cdot130=260$ permutations.