# -*- coding: utf-8 -*-
import io, sys, os, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
kws=["Round","deadline","Deadline","August","October","November","January","February","March","April","May","tuition","Tuition","$","GRE","GMAT","TOEFL","IELTS","minimum","GPA","prerequisite","credit","STEM","optional","required","recommend","essay","recommendation","resume","work experience","undergraduate","accredited","part-time","online"]
for name in ["mfin-app","mfin-tui","mfin-cur","mm-app","mm-tui","mm-cur","mmkt-app","mmkt-tui","mmkt-cur"]:
    t=open("_17_"+name+".txt",encoding="utf-8").read()
    t=html.unescape(re.sub(r"<script.*?</script>","",t,flags=re.S))
    t=html.unescape(re.sub(r"<style.*?</style>","",t,flags=re.S))
    t=re.sub(r"<[^>]+>"," ",t); t=html.unescape(re.sub(r"\s+"," ",t))
    print("\n"+"#"*22,name,"len",len(t))
    seen=set()
    for kw in kws:
        for m in re.finditer(re.escape(kw),t):
            s=max(0,m.start()-55); e=min(len(t),m.end()+95)
            seg=t[s:e]
            if seg in seen: break
            seen.add(seg)
            print(f"  [{kw}] {seg}")
            break
