public class Main {
public static void main(String args[]) {
printSSWAscii(“ab”,"");
}
public static void printSSWAscii(String str, String result){
if(str.length()==0){
System.out.println(result);
return;
}
char c = str.charAt(0);
String ros = str.substring(1);
printSSWAscii(ros,result);
for(int i = 0 ; i < result.length() ; i++){
char cc = result.charAt(i);
int ascii = (int)cc;
System.out.println(ascii);
}
printSSWAscii(ros,result + c);
for(int i = 0 ; i < (result+c).length() ; i++){
char a = (result+c).charAt(i);
int ascii = (int)a;
String res = (result+c).substring(0,i) + ascii + (result+c).substring(i+1);
System.out.println(res);
}
}
}
IF I INPUT “ab”, THEN I AM GETTING ALL THE OUTPUTS APART FROM 9798, I AM NOT GETTING THE ASCII VALUE OF BOTH “ab” AT ONCE THAT IS 9798.