def stars(input):
    l = len(input)
for i in range(2 ** l):
    yield ''.join([('*' if i & 2 ** (l - pos - 1) else ch) for pos, ch in
        enumerate(input)])
Replacing chars in a string in every way