%{
    #include<stdio.h>
    int lc=0, tc=0, sc=0, cc=0;
%}

%%

\n     { lc++; }
\t     { tc++; }
" "    { sc++; }
[^\n\t ] { cc++; }

%%

int yywrap() {
    return 1;
}

int main() {
    printf("Enter text (Ctrl+D to end input):\n");
    yylex();
    
    printf("The number of lines: %d\n", lc);
    printf("The number of blank spaces: %d\n", sc);
    printf("The number of tabs: %d\n", tc);
    printf("The number of other characters: %d\n", cc);

    return 0;
}
