%{
#include<stdio.h>
int lc=0,sc=0,wc=0,tc=0,ch=0;
%}
%%
[\n]{lc++,ch+=yyleng;}
[\t]{sc++,ch+=yyleng;}
[^\t]{tc++,ch+=yyleng;}
[^\t\n]+{wc++,ch+=yyleng;}
%%
int yywrap(){return 1;}
int main(){
printf("enter the string");
yylex();
printf("words: %d",wc);
printf("lines: %d",lc);
printf("spaces: %d",sc);
printf("tabs,char %d,%d",tc,ch);
return 0;
}
JXsKICAgICNpbmNsdWRlPHN0ZGlvLmg+CiAgICBpbnQgbGM9MCxzYz0wLHdjPTAsdGM9MCxjaD0wOwolfQolJQpbXG5de2xjKyssY2grPXl5bGVuZzt9CltcdF17c2MrKyxjaCs9eXlsZW5nO30KW15cdF17dGMrKyxjaCs9eXlsZW5nO30KW15cdFxuXSt7d2MrKyxjaCs9eXlsZW5nO30KJSUKaW50IHl5d3JhcCgpe3JldHVybiAxO30KCmludCBtYWluKCl7CiAgICBwcmludGYoImVudGVyIHRoZSBzdHJpbmciKTsKICAgIHl5bGV4KCk7CiAgICBwcmludGYoIndvcmRzOiAlZCIsd2MpOwogICAgcHJpbnRmKCJsaW5lczogJWQiLGxjKTsKICAgIHByaW50Zigic3BhY2VzOiAlZCIsc2MpOwogICAgcHJpbnRmKCJ0YWJzLGNoYXIgJWQsJWQiLHRjLGNoKTsKICAgIHJldHVybiAwOwp9