
    Write a function that analyzes a transaction pattern number, where each digit represents the frequency of a specific transaction type, to determine if the system's security rule is violated. The security rule states that the count of each transaction type (represented by each digit in the number) must not exceed the transaction type's designated limit (represented by the digit itself). For example, in pattern 2314, there cannot be more than 2 ATM withdrawals, 3 online transfers, 1 check deposit, and 4 card purchases.
    

    
def validate(n):
    """
    Write a function that analyzes a transaction pattern number, where each digit represents the frequency of a specific transaction type, to determine if the system's security rule is violated. The security rule states that the count of each transaction type (represented by each digit in the number) must not exceed the transaction type's designated limit (represented by the digit itself). For example, in pattern 2314, there cannot be more than 2 ATM withdrawals, 3 online transfers, 1 check deposit, and 4 card purchases.
    

    """
def validate(n):
    """
    Write a function that analyzes a transaction pattern number, where each digit represents the frequency of a specific transaction type, to determine if the system's security rule is violated. The security rule states that the count of each transaction type (represented by each digit in the number) must not exceed the transaction type's designated limit (represented by the digit itself). For example, in pattern 2314, there cannot be more than 2 ATM withdrawals, 3 online transfers, 1 check deposit, and 4 card purchases.
    

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