#include <stdio.h>


/*
 * Function: validateIrishLicense
 * Description: Validates an Irish license plate
 *              for years 2013 through 2024.
 *
 * Parameters:
 * year     - Two-digit year (13-24)
 * halfYear - Registration period (1 or 2)
 * county   - County registration code
 * sequence - Registration sequence number
 *
 * Returns: 1 if valid, 0 if invalid
 */

// Function Prototype
int validateIrishLicense(int year, int halfYear,
                         char county, int sequence);

int main()
{
    int retVal;

    // Test 1: Valid license plate
    retVal = validateIrishLicense(13, 1, 'D', 21);
    printf("Test 1: %d\n", retVal);

    // Test 2: Invalid half year and county
    retVal = validateIrishLicense(13, 3, 'K', 1);
    printf("Test 2: %d\n", retVal);

    // Test 3: Invalid sequence number
    retVal = validateIrishLicense(24, 1, 'C', 1245891);
    printf("Test 3: %d\n", retVal);

    // Test 4: Valid lowercase county
    retVal = validateIrishLicense(20, 2, 'g', 456);
    printf("Test 4: %d\n", retVal);

    return 0;
}

// Function Definition
int validateIrishLicense(int year, int halfYear,
                         char county, int sequence)
{
    // Validate year
    if (year < 13 || year > 24)
    {
        return 0;
    }

    // Validate half year
    if (halfYear != 1 && halfYear != 2)
    {
        return 0;
    }

    // Validate county
    if (county != 'C' && county != 'c' &&
        county != 'D' && county != 'd' &&
        county != 'G' && county != 'g' &&
        county != 'L' && county != 'l' &&
        county != 'T' && county != 't' &&
        county != 'W' && county != 'w')
    {
        return 0;
    }

    // Validate sequence number
    if (sequence < 1 || sequence > 999999)
    {
        return 0;
    }

    // All conditions passed
    return 1;
}
