FWIW, a `defaultdict(int)` would eliminate this conditional.