%{
#include<stdio.h>
int nf=0, p=0, n=0, pf=0;
%}
%%
[+]?[0-9]+ {p++;}
[-][0-9]+ {n++;}
[+]?[0-9]*[.][0-9]+ {pf++;}
[-][0-9]*[.][0-9]+ {nf++;}
# {return 0;}
%%
int yywrap(){
return 1;
}
int main(){
printf("Enter numbers (use # to end):\\n");
yylex();
printf("Positive Integers: %d\\n", p);
printf("Negative Integers: %d\\n", n);
printf("Positive Fractions: %d\\n", pf);
printf("Negative Fractions: %d\\n", nf);
return 0;
}