# -*- coding: utf-8 -*-
"""打印 Waterloo 项目页正文核心段（Overview -> 页脚前）"""
import io, sys

for f in sys.argv[1:]:
    t = io.open(f, encoding='utf-8', errors='ignore').read().splitlines()
    print('\n==== ', f, len(t))
    try:
        s = next(i for i, l in enumerate(t) if 'Program overview' in l)
    except StopIteration:
        s = 0
    try:
        e = next(i for i, l in enumerate(t) if 'Information about Future Graduate Students' in l)
    except StopIteration:
        e = len(t)
    for l in t[max(0, s - 26):e]:
        print(l)
