%{
#include <stdio.h>
#include <ctype.h>
int lines = 0, words = 0, chars = 0;
%}

%option noyywrap

%%
\n          { lines++; chars++; }  
[ \t]+      { chars += yyleng; }  
[a-zA-Z_][a-zA-Z0-9_]* { words++; chars += yyleng; printf("Identifier: %s\n", yytext); }
[0-9]+      { chars += yyleng; printf("Number: %s\n", yytext); }
[+\-*/=<>!&|]+ { chars += yyleng; printf("Operator: %s\n", yytext); }
[{}()\[\],;] { chars += yyleng; printf("Special Character: %s\n", yytext); }
.           { chars += yyleng; }

%%

int main() {
    yylex();
    printf("\nLines: %d\nWords: %d\nCharacters: %d\n", lines, words, chars);
    return 0;
}
