Print all subsequences of a string in Python
Given a string, we have to find out all subsequences of it. A String is a subsequence of a given String, that is generated by deleting some character of a given string without changing its order.
Input : abc Output : a, b, c, ab, bc, ac, abc Input : aaa Output : a, aa, aaa
Using Pick and Don’t Pick concept :
cba cb ca c ba b a
a b c ab ac bc abc
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course