For this Question: Given a string S. The task is to print all permutations of the characters in the given string.The only line of input contains a string S with all distinct uppercase letters of the English alphabet.

Constraints:-
1<=|S|<=8Print all permutations of a given string S with single space and all permutations should be in lexicographically increasing order.Sample Input:
ABC

Sample Output:
ABC ACB BAC BCA CAB CBA, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {


					  static ArrayList<String> solution = new ArrayList<String>();
					  public static char[] swap(char[] charArray, int i, int j){
						  char temp;
						  temp = charArray[i];
						  charArray[i] = charArray[j];
						  charArray[j] = temp;

						  return charArray;
					  }
					  public static void permute(char[] charArray, int left, int right){
						  if(left == right){
							  String str = new String(charArray);
							  solution.add(str);
						  }
						  else{
							  for(int i=left; i<=right; i++)
							  {
								  charArray = swap(charArray, left, i);
								  permute(charArray, left+1, right);
								  charArray = swap(charArray, left, i);
							  }
						  }
					  }
					  public static void main(String[] args)
					  {
						  Scanner s = new Scanner(System.in);
						  String str = s.nextLine();
						  int n = str.length();
						  char[] charArray = str.toCharArray();
						  permute(charArray, 0, n-1);

						  Collections.sort(solution);
						  for(int i = 0; i < solution.size(); i++){
							  System.out.print(solution.get(i)+" ");
						  }
					  }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?