%{
#include <stdio.h>
#include <stdlib.h>
%}
%%
[0-9]+ {
int num = atoi(yytext);
if (num % 2 == 0)
printf("%s is EVEN\n", yytext);
else
printf("%s is ODD\n", yytext);
}
\n { /* Ignore new lines */ }
. { printf("Invalid input: %s\n", yytext); }
%%
int main() {
printf("Enter numbers (Ctrl+D to stop):\n");
yylex();
return 0;
}
int yywrap() {
return 1;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KJX0KCiUlClswLTldKyAgeyAKICAgICAgICAgICAgaW50IG51bSA9IGF0b2koeXl0ZXh0KTsKICAgICAgICAgICAgaWYgKG51bSAlIDIgPT0gMCkKICAgICAgICAgICAgICAgIHByaW50ZigiJXMgaXMgRVZFTlxuIiwgeXl0ZXh0KTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgcHJpbnRmKCIlcyBpcyBPRERcbiIsIHl5dGV4dCk7CiAgICAgICAgfQoKXG4gICAgICB7IC8qIElnbm9yZSBuZXcgbGluZXMgKi8gfQouICAgICAgIHsgcHJpbnRmKCJJbnZhbGlkIGlucHV0OiAlc1xuIiwgeXl0ZXh0KTsgfQoKJSUKCmludCBtYWluKCkgewogICAgcHJpbnRmKCJFbnRlciBudW1iZXJzIChDdHJsK0QgdG8gc3RvcCk6XG4iKTsKICAgIHl5bGV4KCk7CiAgICByZXR1cm4gMDsKfQoKaW50IHl5d3JhcCgpIHsKwqDCoMKgwqByZXR1cm7CoDE7Cn0=