class Combination { //This method prints all combinations whose String representation //(WHERE ORDER AMONG CHARACTERS DOES NOT MATTER) consists of S //concatenated with L characters from {A[i],A[i+1],...} public static void CombS(char[] A, int i, int L, String S) { int current_size_of_set = A.length - i; if(L==0) System.out.println(S); else { CombS(A,i+1,L-1,S+A[i]); if(current_size_of_set>L) CombS(A,i+1,L,S); } } //This method is used jst for better readability and understandability //Otherwise we could have directly called CombS(A,0,L,"") from main; public static void Combination(char[] A, int i, int L) { CombS(A,i,L,""); } public static void main(String args[]) { char[] A = new char[args[0].length()]; for(int i = 0; i