# -*- coding: utf-8 -*-
import sys, io, pathlib
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52")
for n in ["bme","bioe","biology","medphys","mgmt","bcfm","econ","math"]:
    f = BASE / ("_r343_txt_" + n + ".txt")
    L = f.read_text(encoding="utf-8").split("\n")
    idx = [i for i, x in enumerate(L) if x.strip() == "Overview"]
    s = idx[-1] if idx else 0
    e = next((i for i in range(s, len(L)) if L[i].startswith("Georgia Tech Resources")), len(L))
    out = BASE / ("_r343_body_" + n + ".txt")
    out.write_text("\n".join(L[s:e]), encoding="utf-8")
    print(n, "start", s, "end", e, "lines", e - s)
