%{
#include <stdio.h>
int line_count = 0, space_count = 0, tab_count = 0, other_count = 0;
%}
%%
\n { line_count++; }
" " { space_count++; }
\t { tab_count++; }
. { other_count++; }
%%
int main() {
printf("Enter input :\n");
yylex();
printf("Lines: %d\n", line_count);
printf("Spaces: %d\n", space_count);
printf("Tabs: %d\n", tab_count);
printf("Other Characters: %d\n", other_count);
return 0;
}
int yywrap() {
return 1;
}
JXsgCiNpbmNsdWRlIDxzdGRpby5oPiAKaW50IGxpbmVfY291bnQgPSAwLCBzcGFjZV9jb3VudCA9IDAsIHRhYl9jb3VudCA9IDAsIG90aGVyX2NvdW50ID0gMDsgCiV9IAogCiUlIApcbiAgICAgICAgeyBsaW5lX2NvdW50Kys7IH0gCiIgIiAgICAgIHsgc3BhY2VfY291bnQrKzsgfSAKXHQgICAgICAgeyB0YWJfY291bnQrKzsgfSAKLiAgICAgICAgeyBvdGhlcl9jb3VudCsrOyB9IAolJSAKIAppbnQgbWFpbigpIHsgCiAgICBwcmludGYoIkVudGVyIGlucHV0IDpcbiIpOyAKICAgIHl5bGV4KCk7IAogICAgcHJpbnRmKCJMaW5lczogJWRcbiIsIGxpbmVfY291bnQpOyAKICAgIHByaW50ZigiU3BhY2VzOiAlZFxuIiwgc3BhY2VfY291bnQpOyAKICAgIHByaW50ZigiVGFiczogJWRcbiIsIHRhYl9jb3VudCk7IAogICAgcHJpbnRmKCJPdGhlciBDaGFyYWN0ZXJzOiAlZFxuIiwgb3RoZXJfY291bnQpOyAKICAgIHJldHVybiAwOyAKfSAKaW50IHl5d3JhcCgpIHsgCiAgICByZXR1cm4gMTsgCn0=