%{
#include <stdio.h>
int chars=0,words=0,newLine=0,space=0;
%}
%%
[a-zA-Z]+ {words++; chars+=yyleng;}
[ ] {space++;}
[\n] {newLine++;}
%%
int yywrap(){
return 1;
}
int main(){
printf("Enter String: ");
//This will be called when takin in the inout and calling the whole thing defined
inside the %% %%
yylex();
printf("Characters: %d\n",chars);
printf("Words: %d\n",words);
printf("Spaces: %d\n",space);
printf("New Lines: %d\n",newLine);
}