%{
#include <stdio.h>
int vowels = 0, consonants = 0;
%}
%%
[aeiouAEIOU] { vowels++; }
[a-zA-Z] { consonants++; }
[^a-zA-Z\n] ; /* Ignore non-alphabetic characters */
\n { /* Ignore newlines */ }
%%
int main() {
printf("Enter text (Ctrl+D to end on Unix/Mac, Ctrl+Z on Windows):\n");
yylex();
printf("\nNumber of vowels: %d\n", vowels);
printf
("
Number of consonants
: %d\n", consonants); return 0;
}
int yywrap() {
return 1;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CmludCB2b3dlbHMgPSAwLCBjb25zb25hbnRzID0gMDsKJX0KCiUlClthZWlvdUFFSU9VXSAgICAgeyB2b3dlbHMrKzsgfQpbYS16QS1aXSAgICAgICAgICB7IGNvbnNvbmFudHMrKzsgfQpbXmEtekEtWlxuXSAgICAgICA7IC8qIElnbm9yZSBub24tYWxwaGFiZXRpYyBjaGFyYWN0ZXJzICovClxuICAgICAgICAgICAgICAgIHsgLyogSWdub3JlIG5ld2xpbmVzICovIH0KJSUKCmludCBtYWluKCkgewogICAgcHJpbnRmKCJFbnRlciB0ZXh0IChDdHJsK0QgdG8gZW5kIG9uIFVuaXgvTWFjLCBDdHJsK1ogb24gV2luZG93cyk6XG4iKTsKICAgIHl5bGV4KCk7CiAgICBwcmludGYoIlxuTnVtYmVyIG9mIHZvd2VsczogJWRcbiIsIHZvd2Vscyk7CiAgICBwcmludGYoIk51bWJlciBvZiBjb25zb25hbnRzOiAlZFxuIiwgY29uc29uYW50cyk7CiAgICByZXR1cm4gMDsKfQoKaW50IHl5d3JhcCgpIHsKICAgIHJldHVybiAxOwp9Cg==