
    Write a function that validates a social media post's numerical ID where each digit represents a content category (1-text, 2-images, 3-videos, etc.), ensuring that the frequency of each category in the ID doesn't exceed its corresponding category number to prevent potential spam. For example, category 1 cannot appear more than once, category 2 cannot appear more than twice, and so on.
    

    
def validate(n):
    """
    Write a function that validates a social media post's numerical ID where each digit represents a content category (1-text, 2-images, 3-videos, etc.), ensuring that the frequency of each category in the ID doesn't exceed its corresponding category number to prevent potential spam. For example, category 1 cannot appear more than once, category 2 cannot appear more than twice, and so on.
    

    """
def validate(n):
    """
    Write a function that validates a social media post's numerical ID where each digit represents a content category (1-text, 2-images, 3-videos, etc.), ensuring that the frequency of each category in the ID doesn't exceed its corresponding category number to prevent potential spam. For example, category 1 cannot appear more than once, category 2 cannot appear more than twice, and so on.
    

    """
    for i in range(10):
        temp = n
        count = 0
        while temp:
            if temp % 10 == i:
                count += 1
            if count > i:
                return False
            temp //= 10
    return True