in reply to Algebraic Expansion of Binomials Using a Recursive Subroutine

The string substitions you are doing are incorrect. If you choose n = 14, then instead of + 1001x^10y^4<c> it prints <c>+ 100x0y^4. Further, the program prints an extra plus sign at the very end of the expression.

Update: the \b regex anchor gives an easy way to fix these bugs in the substitutions.