%{
#include <stdio.h>
int char_count = 0;
int word_count = 0;
int space_count = 0;
%}
%%
[ \t\n]+ { space_count += yyleng; char_count += yyleng; }
[^ \t\n]+ { word_count++; char_count += yyleng; }
%%
int main() {
yylex();
printf
("The
number of total characters in the given input file\nis
: %d\n", char_count); printf
("The
number of total words in the given input file
is: %d\n", word_count); printf
("The
number of total white spaces in the given input\nfile
is: %d\n", space_count); return 0;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CmludCBjaGFyX2NvdW50ID0gMDsKaW50IHdvcmRfY291bnQgPSAwOwppbnQgc3BhY2VfY291bnQgPSAwOwolfQoKJSUKClsgXHRcbl0rIHsgc3BhY2VfY291bnQgKz0geXlsZW5nOyBjaGFyX2NvdW50ICs9IHl5bGVuZzsgfQpbXiBcdFxuXSsgeyB3b3JkX2NvdW50Kys7IGNoYXJfY291bnQgKz0geXlsZW5nOyB9CgolJQoKaW50IG1haW4oKSB7CiAgICB5eWxleCgpOwogICAgcHJpbnRmKCJUaGUgbnVtYmVyIG9mIHRvdGFsIGNoYXJhY3RlcnMgaW4gdGhlIGdpdmVuIGlucHV0IGZpbGVcbmlzOiAlZFxuIiwgY2hhcl9jb3VudCk7CiAgICBwcmludGYoIlRoZSBudW1iZXIgb2YgdG90YWwgd29yZHMgaW4gdGhlIGdpdmVuIGlucHV0IGZpbGUgaXM6ICVkXG4iLCB3b3JkX2NvdW50KTsKICAgIHByaW50ZigiVGhlIG51bWJlciBvZiB0b3RhbCB3aGl0ZSBzcGFjZXMgaW4gdGhlIGdpdmVuIGlucHV0XG5maWxlIGlzOiAlZFxuIiwgc3BhY2VfY291bnQpOwogICAgcmV0dXJuIDA7Cn0=