import re import sys def pies(input): for _, l in enumerate(input, start=1): if re.search(r'\bpies\b', l, flags=re.IGNORECASE): print(l.strip()) pies(sys.stdin)