#include <stdio.h>
int validateIrishLicense(int year, int halfYear, char County, int Sequence1);
int main(void) {
int valid=validateIrishLicense(13,1,'D',-12);
printf("The license is valid or not (1=valid, 0=no): %i\n", valid
); return 0;
}
int validateIrishLicense(int year, int halfYear, char County, int Sequence1){
int check=0;
if (year>=13 & year<=24){
check+=1;
}
if (halfYear==1 | halfYear==2){
check+=1;
}
char valid_county[]= {'C','c','D','d','G','g','L','l','T','t','W','w'};
const VAL_COUNTIES=12;
for (int i=0; i < VAL_COUNTIES; i++) {
if (County==valid_county[i]){
check+=1;
}
}
int digits=1;
while ((Sequence1/10)>0){
digits+=1;
Sequence1 /=10;
}
printf("Number of digits: %i\n", digits
);
if (check==3){
return 1;
}
else{
return 0;
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgdmFsaWRhdGVJcmlzaExpY2Vuc2UoaW50IHllYXIsIGludCBoYWxmWWVhciwgY2hhciBDb3VudHksIGludCBTZXF1ZW5jZTEpOwoKaW50IG1haW4odm9pZCkgewoJaW50IHZhbGlkPXZhbGlkYXRlSXJpc2hMaWNlbnNlKDEzLDEsJ0QnLC0xMik7CiAgICBwcmludGYoIlRoZSBsaWNlbnNlIGlzIHZhbGlkIG9yIG5vdCAoMT12YWxpZCwgMD1ubyk6ICVpXG4iLCB2YWxpZCk7CglyZXR1cm4gMDsKfQoKaW50IHZhbGlkYXRlSXJpc2hMaWNlbnNlKGludCB5ZWFyLCBpbnQgaGFsZlllYXIsIGNoYXIgQ291bnR5LCBpbnQgU2VxdWVuY2UxKXsKCiAgICBpbnQgY2hlY2s9MDsKCiAgICBpZiAoeWVhcj49MTMgJiB5ZWFyPD0yNCl7CiAgICAgICAgY2hlY2srPTE7CiAgICB9CgogICAgaWYgKGhhbGZZZWFyPT0xIHwgaGFsZlllYXI9PTIpewogICAgICAgICBjaGVjays9MTsKICAgIH0KCiAgICBjaGFyIHZhbGlkX2NvdW50eVtdPSB7J0MnLCdjJywnRCcsJ2QnLCdHJywnZycsJ0wnL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