%{
#include <stdio.h>
#include <stdlib.h>

%}

digit   [0-9]
number  {digit}+  /* Matches a sequence of digits representing a number */

%%

{number}  {
            int num = atoi(yytext);  // Convert the matched text to an integer
            if (num % 2 == 0) {
                printf("%d is even\n", num);
            } else {
                printf("%d is odd\n", num);
            }
        }

%%

int main(int argc, char *argv[]) {
    if (argc > 1) {
        yylex();  // Run lexical analyzer on the input string
    } else {
        printf("Please provide a number as an argument.\n");
    }
    return 0;
}
