# -*- 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")
def text(f):
    raw=open(f,encoding="utf-8",errors="replace").read()
    t=re.sub(r'<script[\s\S]*?</script>',' ',raw); t=re.sub(r'<style[\s\S]*?</style>',' ',t)
    return html.unescape(re.sub(r'\s+',' ',re.sub(r'<[^>]+>',' ',t))).strip()

for f,keys in [
 ("_27_usc-cac5b60.txt",["Master of Science in Finance","MSF","16 Month","36-unit","online","on-campus","STEM","deadline","TOEFL","IELTS","GRE","GMAT","tuition","Tuition","units"]),
 ("_27_usc-c531fe9.txt",["MSBA","Business Analytics","16.5","STEM","2 Years","deadline","TOEFL","IELTS","GRE","GMAT","Tuition","units","internship"]),
]:
    t=text(f); print("\n########",f,"len",len(t))
    for k in keys:
        for m in re.finditer(re.escape(k),t):
            i=m.start(); print(f'  [{k}] …{t[max(0,i-60):i+130]}…'); break
