<gh_stars>1-10
import sys

chars = "ACGT"

## check neighbors

def neighbors(pattern, d):
    assert(d <= len(pattern))

    if d == 0:
        return [pattern]

    r2 = neighbors(pattern[1:], d-1)
    r = [c + r3 for r3 in r2 for c in chars if c != pattern[0]]

    if (d < len(pattern)):
        r2 = neighbors(pattern[1:], d)
        r += [pattern[0] + r3 for r3 in r2]

    return r

pattern = sys.argv[1]
d = int(sys.argv[2])

print(neighbors(pattern, d), len(neighbors(pattern, d)))

import sys

chars = "ACGT"

## check neighbors

def neighbors(pattern, d):
    assert(d <= len(pattern))

    if d == 0:
        return [pattern]

    r2 = neighbors(pattern[1:], d-1)
    r = [c + r3 for r3 in r2 for c in chars if c != pattern[0]]

    if (d < len(pattern)):
        r2 = neighbors(pattern[1:], d)
        r += [pattern[0] + r3 for r3 in r2]

    return r

pattern = sys.argv[1]
d = int(sys.argv[2])

print(neighbors(pattern, d), len(neighbors(pattern, d)))
## check neighbors