Starting from fractional supersymmetry as an extended Virasoro algebra, we generalize Felder's BRST cohomology method to construct the characters and branching functions - in terms of string functions - of the SU(2) and SU(3) coset models, for both the unitary and nonunitary cases.