import os, re, html, io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
BASE = os.path.dirname(os.path.abspath(__file__))
def clean(raw):
    t=re.sub(r'<script[\s\S]*?</script>',' ',raw)
    t=re.sub(r'<style[\s\S]*?</style>',' ',t)
    t=re.sub(r'<[^>]+>',' ',t)
    return html.unescape(re.sub(r'\s+',' ',t)).strip()
for tag in ["mit-msms","mit-scm-res"]:
    raw=open(os.path.join(BASE,f"_26_{tag}.txt"),encoding="utf-8").read()
    t=clean(raw)
    # 定位正文起点（标题后）
    i=t.find("Website:")
    if i<0: i=t.find("Home Programs")
    print("="*30,tag)
    print(t[i:i+2600])
    print()
