%{
int kcount = 0;
int icount = 0;
%}
keywords (if|else|while|return|for)
identifiers ([a-zA-Z][a-zA-Z0-9]*)
%%
{keywords} {kcount++;}
{identifiers} {icount++;}
%%
void main()
yylex();
printf("No.of Keywords: %d\n", kcount);
printf("No.of Identifiers: %d\n", icount);
}
int yywrap()
{
return 1;
}
JXsKICBpbnQga2NvdW50ID0gMDsKICBpbnQgaWNvdW50ID0gMDsKICAlfQogIGtleXdvcmRzIChpZnxlbHNlfHdoaWxlfHJldHVybnxmb3IpCiAgaWRlbnRpZmllcnMgKFthLXpBLVpdW2EtekEtWjAtOV0qKQogICUlCiAge2tleXdvcmRzfSB7a2NvdW50Kys7fQogIHtpZGVudGlmaWVyc30ge2ljb3VudCsrO30KICAlJQogIHZvaWQgbWFpbigpCiAgeXlsZXgoKTsKICBwcmludGYoIk5vLm9mIEtleXdvcmRzOiAlZFxuIiwga2NvdW50KTsKICBwcmludGYoIk5vLm9mIElkZW50aWZpZXJzOiAlZFxuIiwgaWNvdW50KTsKICB9CiAgaW50IHl5d3JhcCgpCiAgewogICAgcmV0dXJuIDE7CiAgICAKICB9