#! /usr/bin/env python

import sys

with open(sys.argv[1]) as fd:
    pattern = fd.next().strip()
    genome = fd.next().strip()

output = list()
k = len(pattern)
for i in range(len(genome)):
    ptrn = genome[i : i + k]
    if ptrn == pattern:
        output.append(str(i))

print " ".join(output)

491b955da3ac1be4f3855ad3338eaa351001614b
#! /usr/bin/env python

import sys

with open(sys.argv[1]) as fd:
    pattern = fd.next().strip()
    genome = fd.next().strip()

output = list()
k = len(pattern)
for i in range(len(genome)):
    ptrn = genome[i : i + k]
    if ptrn == pattern:
        output.append(str(i))

print " ".join(output)
