Permutation of the string means all the possible new strings that can be formed by interchanging the position of the characters of the string. For example, string ABC has permutations [ABC, ACB, BAC, BCA, CAB, CBA].
Example: Java program to get all the permutation of a string
Output
Enter the string: ABC Permutations of ABC: [ACB, BCA, ABC, CBA, BAC, CAB]
In Java, we have used the recursion to compute all the permutations of a string. Here, we store the permutation in a set. So, there will be no duplicate permutation.