Tricky permutation

According to the editorial of this question, if I pass “ABA” as input, won’t I get AAB AAB ABA ABA as the output ?

No, the question asks you to print the non-repeating permutations. That is , for this example. AAB, ABA, BAA