from typing import Counter


def breakdown_structure(connection_counter: Counter, rules: dict) -> Counter:
    """breaksdown the polymer structure and add new elements

    Args:
        connection_counter (Counter): Initial count of each connection
        rules (dict): Rules how to break down each connection

    Returns:
        Counter: new polymer structure represented by the number for each pairs

    Examples:
        >>> breakdown_structure(Counter(AB = 1), {"AB":"C"})
        Counter({'AC': 1, 'CB': 1})
        >>> breakdown_structure(Counter(AB = 1, BC = 4), {"AB":"C", "BC":"A"})
        Counter({'AC': 5, 'BA': 4, 'CB': 1})
    """
    new_counter = Counter()
    for poly_pair in connection_counter:
        new_counter[poly_pair[0] + rules[poly_pair]] += connection_counter[poly_pair]
        new_counter[rules[poly_pair] + poly_pair[1]] += connection_counter[poly_pair]
    return new_counter