Read line

for line in iter(sys.stdin.readline, ""):  # iter/readline for line-buffering
    goatD.detect(line)