%{
#include<stdio.h>
int lc=0,wc=0,cc=0,sc=0;
%}
%%
[\n] {lc++;cc+=yylength;}
[\t] {sc++;cc+=yylength;}
[^\n\t]+ {wc++;cc+=yylength;}
%%
int yywrap()
{
return 1;
}
int main(int argc,char* argv[])
{
printf("enter the input");
yylex();
printf
("
number of lines
=%d\n",lc); printf
("
number od words
=%d\n",wc); printf
("
number of space
=%d\n",sc); printf
("
NUmber of characters
=%d\n",cc);}
JXsKICAjaW5jbHVkZTxzdGRpby5oPgogIGludCBsYz0wLHdjPTAsY2M9MCxzYz0wOwolfQolJQpbXG5dIHtsYysrO2NjKz15eWxlbmd0aDt9CltcdF0ge3NjKys7Y2MrPXl5bGVuZ3RoO30KW15cblx0XSsge3djKys7Y2MrPXl5bGVuZ3RoO30KJSUKaW50IHl5d3JhcCgpCnsKICByZXR1cm4gMTsKfQppbnQgbWFpbihpbnQgYXJnYyxjaGFyKiBhcmd2W10pCnsKICBwcmludGYoImVudGVyIHRoZSBpbnB1dCIpOwogIHl5bGV4KCk7CiAgcHJpbnRmKCJudW1iZXIgb2YgbGluZXM9JWRcbiIsbGMpOwogIHByaW50ZigibnVtYmVyIG9kIHdvcmRzPSVkXG4iLHdjKTsKICBwcmludGYoIm51bWJlciBvZiBzcGFjZT0lZFxuIixzYyk7CiAgcHJpbnRmKCJOVW1iZXIgb2YgY2hhcmFjdGVycz0lZFxuIixjYyk7Cn0K