# -*- coding: utf-8 -*-
import json, re, os, io, sys, collections
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
BASE=os.path.dirname(os.path.abspath(__file__))
main=open(os.path.join(BASE,'index_main.html'),encoding='utf-8').read()
prog=main[main.find('const PROGRAMS='):main.find('const CATD=')]
rows=re.findall(r'\{id:"([^"]+)",s:"([^"]+)",n:"([^"]*)",en:"([^"]+)"',prog)
bys=collections.defaultdict(list)
for sid,s,n,en in rows: bys[s].append((sid,en))
for sc in ['up','mit','geo','uw','nyu','cmu','yale','cornell','wustl','rice','notre','brown','harvard','dartmouth','jhu','illinois']:
    print('###',sc,len(bys[sc]))
    for sid,en in bys[sc]:
        print('  ',sid,'|',en[:70])
