# -*- coding: utf-8 -*-
import io, sys, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")

def ctx(fn, kws, width=260):
    t = open(fn, encoding="utf-8").read()
    print(f"===== {fn} =====")
    for kw in kws:
        for m in re.finditer(re.escape(kw), t, re.I):
            s = max(0, m.start()-width//2); e = min(len(t), m.end()+width//2)
            print(f"[{kw}] …{t[s:e]}…")
            break

ctx("_cornell_meng_guide.txt", ["TOEFL", "IELTS", "2098", "application fee", "Standing", "Exemption"])
print()
ctx("_cornell_faq.txt", ["STEM", "self-funded", "GTRS", "tuition fellowship", "Distance", "part-time", "PhD", "doctoral"])
