from collections import defaultdict

lines = open("parent_indices.txt", "r").readlines()
lines = [line.strip().split("-") for line in lines]

total_counts = defaultdict(int)
total_accepted_counts = defaultdict(int)
for pars, idxs, accpted in lines:
    pars = eval(pars)
    idxs = eval(idxs)
    accpted = eval(accpted)
    idx = 1
    while idx < len(pars):
        cnts = defaultdict(int)
        for i in range(10):
            cnts[pars[idx]] += 1
            if idx in idxs:
                total_counts[cnts[pars[idx]]] += 1
            if idx in idxs and accpted[idxs.index(idx)]:
                total_accepted_counts[cnts[pars[idx]]] += 1
            idx += 1
print(total_counts)
print(total_accepted_counts)