%{
#include<stdio.h>
int i = 0;
%}
/* Rules Section */
%%
[a-zA-Z0-9]+ { i++; } /* Rule for counting words (alphanumeric sequences) */
\n
{ printf
("
Number of words
: %d\n", i); i = 0; } /* Output word count at end of each line */%%
int yywrap(void) {
return 1; /* Required function that can just return 1 */
}
int main() {
yylex(); /* Start lexical analysis */
return 0;
}
JXsKI2luY2x1ZGU8c3RkaW8uaD4KaW50IGkgPSAwOwolfQoKLyogUnVsZXMgU2VjdGlvbiAqLwolJQpbYS16QS1aMC05XSsgeyBpKys7IH0gLyogUnVsZSBmb3IgY291bnRpbmcgd29yZHMgKGFscGhhbnVtZXJpYyBzZXF1ZW5jZXMpICovClxuIHsgcHJpbnRmKCJOdW1iZXIgb2Ygd29yZHM6ICVkXG4iLCBpKTsgaSA9IDA7IH0gLyogT3V0cHV0IHdvcmQgY291bnQgYXQgZW5kIG9mIGVhY2ggbGluZSAqLwolJQoKaW50IHl5d3JhcCh2b2lkKSB7CiAgICByZXR1cm4gMTsgLyogUmVxdWlyZWQgZnVuY3Rpb24gdGhhdCBjYW4ganVzdCByZXR1cm4gMSAqLwp9CgppbnQgbWFpbigpIHsKICAgIHl5bGV4KCk7IC8qIFN0YXJ0IGxleGljYWwgYW5hbHlzaXMgKi8KICAgIHJldHVybiAwOwp9Cg==