Return the number of total permutations of the provided string that don’t have repeated consecutive letters. Assume that all characters in the provided string are each unique.

For example, “aab” should return 2 because it has 6 total permutations ( "aab , aab , aba , aba ,baa , baa ), but only 2 of them ( “aba” and “aba” ) don’t have the same letter (in this case “a” ) repeating.

Hi, I need help understanding permutation. Let’s say we have “abcd” the permutation for this is 24. So then the permutation for “aab” is not 6, since order matters but instead 3. Or am doing this wrong. The unique ways to arrange “aab” are aab ,aba, baa. Please help me. How is aab and aab unique. Please

I think the key to this is the following sentence in the instructions:

Assume that all characters in the provided string are each unique.

So yes, even though “a” and “a” are the same character, in the string “aab” you would treat them as different characters when generating the permutations. Then after you have all the permutations you can treat them as the same to remove the consecutive duplicates.