
    Write a function that validates a user's social interaction score by ensuring that each interaction type (represented by a digit) doesn't occur more frequently than its assigned weight value (the digit itself) to maintain balanced user engagement. For example, in a score of 1224, type-2 interactions can occur up to 2 times, type-1 interactions can occur only once, and type-4 interactions can occur up to 4 times.
    

    
def validate(n):
    """
    Write a function that validates a user's social interaction score by ensuring that each interaction type (represented by a digit) doesn't occur more frequently than its assigned weight value (the digit itself) to maintain balanced user engagement. For example, in a score of 1224, type-2 interactions can occur up to 2 times, type-1 interactions can occur only once, and type-4 interactions can occur up to 4 times.
    

    """
def validate(n):
    """
    Write a function that validates a user's social interaction score by ensuring that each interaction type (represented by a digit) doesn't occur more frequently than its assigned weight value (the digit itself) to maintain balanced user engagement. For example, in a score of 1224, type-2 interactions can occur up to 2 times, type-1 interactions can occur only once, and type-4 interactions can occur up to 4 times.
    

    """
    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