Tricky Permutation

why my code passed all test cases except 1?
my code –https://ide.codingblocks.com/s/164837

@sudhanshusoni500,
You need to optimize your code. Since the max length of the string is 8. Your code fails for “ABCDEFGH”