# -*- coding: utf-8 -*-
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
P = "index_main.html"
h = open(P, encoding="utf-8").read()
old = '"Computer Science", "计算机科学（博士）", "PhD", "https://www.cs.uchicago.edu/graduate/phd-programs/"'
new = '"Computer Science", "计算机科学博士（PhD）", "PhD", "https://www.cs.uchicago.edu/graduate/phd-programs/"'
n = h.count(old)
print("match count:", n)
if n == 1:
    h = h.replace(old, new, 1)
    open(P, "w", encoding="utf-8").write(h)
    print("CATD n synced to 计算机科学博士（PhD）")
else:
    print("未替换：匹配不唯一或未命中")
