i have printed the subsequences but dont know to sort them.how to do it here.
import java.util.*;
public class Main {
public static void main(String args[]) {
int n;
String str="";
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
sc.nextLine();
for(int i=0;i<n;i++){
str=sc.nextLine();
printss(str," ");
}
}
public static void printss(String str,String result){
if(str.length()==0){
System.out.println(result);
return;
}
char cc=str.charAt(0);
String ros=str.substring(1);
printss(ros,result);
printss(ros,result+cc);
}
}