Tricky permutation

getting two case error

Your code is giving wrong answer for string: AAAB. Put all strings in a set and then print it.

how to do that ? sir have not taught set till now