# -*- 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 clean(fn):
    raw=open(fn,"rb").read().decode("utf-8","ignore")
    raw=html.unescape(re.sub(r"<script.*?</script>","",raw,flags=re.S)); raw=html.unescape(re.sub(r"<style.*?</style>","",raw,flags=re.S))
    t=re.sub(r"<[^>]+>"," ",raw); return html.unescape(re.sub(r"\s+"," ",t))
ams=clean("_19_JHU-AMS-MSE.txt")
i=ams.find("Program Requirements")
print("[AMS req]",ams[i:i+700])
bme=clean("_19_JHU-BME-MSE.txt")
j=bme.find("Admission Requirements")
print("\n[BME admit]",bme[j:j+600])
k=bme.find("Course-Based Degree Option")
print("\n[BME course]",bme[k:k+400])
l=bme.find("Thesis-Based")
print("\n[BME thesis]",bme[l:l+300] if l>0 else "n/a")
