Geneate Distinct Subsequences

How can we generate distinct subsequences of a string which contains duplicate characters? Eg: str=“AABBC”