%{
#include <stdio.h>
int count = 0;
%}
%%
[ \t] { count++; } // Count spaces and tabs
. { } // Ignore other characters
\n { return 0; } // Stop processing on newline
%%
int yywrap() {
return 1;
}
int main() {
printf("Enter text:\n");
yylex();
printf
("
Number of spaces and tabs
: %d\n", count); return 0;
}
JXsKICAgICNpbmNsdWRlIDxzdGRpby5oPgogICAgaW50IGNvdW50ID0gMDsKJX0KCiUlCgpbIFx0XSAgIHsgY291bnQrKzsgfSAgIC8vIENvdW50IHNwYWNlcyBhbmQgdGFicwouICAgICAgIHsgfSAgICAgICAgICAgLy8gSWdub3JlIG90aGVyIGNoYXJhY3RlcnMKXG4gICAgICB7IHJldHVybiAwOyB9IC8vIFN0b3AgcHJvY2Vzc2luZyBvbiBuZXdsaW5lCgolJQoKaW50IHl5d3JhcCgpIHsKICAgIHJldHVybiAxOwp9CgppbnQgbWFpbigpIHsKICAgIHByaW50ZigiRW50ZXIgdGV4dDpcbiIpOwogICAgeXlsZXgoKTsKICAgIHByaW50ZigiTnVtYmVyIG9mIHNwYWNlcyBhbmQgdGFiczogJWRcbiIsIGNvdW50KTsKICAgIHJldHVybiAwOwp9Cg==