pattern

CF

String Tree Pattern

Given a String S as the input, the program must print the characters present in the string S as shown in the Example…