Example 84: Generate a Combination of Characters

Learn how to generate all possible combinations of the characters present in a string.

Problem

Write a function to generate and print all possible combinations of the characters present in a given string.

The following figure demonstrates the combination generation process for the string ABC:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.