def next_step(poly_pairs: dict, pair_rules: dict) -> dict:
    """For parm dictionary of polymer pair counts, and transformation rules. Return the output of this transformation
    step.
    For example:
    poly_pairs={'NN': 1, 'NC': 2, 'CB': 3}
    pair_rule={'NN': ['NC', 'CN'], 'NC': ['NB', 'BC'], 'CB': ['CH', 'HB']
    Returns: {'NC': 1, 'CN': 1, 'NB': 2, 'BC': 2, 'CH': 3, 'HB': 3}"""

    pairs = {}
    for pair in poly_pairs:
        for new_pair in pair_rules[pair]:
            if new_pair in pairs:
                pairs[new_pair] += poly_pairs[pair]
            else:
                pairs[new_pair] = poly_pairs[pair]
    return pairs