Print Subsequence

what is the thinking approach here, for deriving the two main smaller problems (to not include first char and to include first char)

public static void main(String[] args)
{
    String s = "abcd";
    printsubsequences(s, ""); 
    
}

private static void printsubsequences(String s,String ans)
{
    if (s.length() == 0) {
        System.out.println(ans);
        return;
    }

    // We add adding 1st character in string
    printsubsequences(s.substring(1), ans + s.charAt(0));

    // Not adding first character of the string
    // because the concept of subsequence either
    // character will present or not
    printsubsequences(s.substring(1), ans);
}

@srishti200201_c9588863a697e1e7 Yes you are correct. I have shared the code so you can get a glimpse to how to approach this problem. This is not the exact code that you can paste on the hackerblocks ide but you have to make some changes accordingly.