I'm trying to show why an algorithm is inefficient. The following isn't exactly how the algorithm works, but it is a good approximation.
Say I have the $10$-character string "$0123456789$". I can remove characters from the string by replacing them with an empty space. Here are a few examples:
"0123456789"
"0 23456789"
"0123 56789"
" 2 56 89"
"012 "
"0 "
" "
If I wanted to iterate through every possible combination, how many iterations would it take? A general solution would be nice because the program actually works on data that has an arbitrary number of elements.
Another way of thinking about this, if you have a computer science background is to think about writing your string but with a $1$ where you keep the original letter and a $0$ where you discard it.
Let's take a string of length $3$ to illustrate my meaning, "abc". First we convert each possible modification into our new representation:
If we then consider these new representations to be binary numbers then we have
Hopefully you can see that we have every number there from $0$ to $7$, that is to say we have $8$ possible modifications of our string.
We know that $8=2^3$ and our string has length $3$, so we can guess that for a string of length $n$ that we would expect to have $2^n$ modifications. I will leave it to you to convince yourself that this is in fact the case.