I have a simple question about finding certain word in text. I want to find the lines of text which contain only "dog" word (not "doggy","doggo" etc.) and print them. I just want to use the simplest capabilities of Python.
Note: this task can't use regex or re library
import sys
word = "dog"
for line in sys.stdin:
x = line.find(word)
if x != -1:
print (line)
What should I change in this code?