%{
#include <stdio.h>
int vowels = 0, consonants = 0;
%}
%%
[aAeEiIoOuU] { vowels++; } // Match vowels (case insensitive)
[b-df-hj-np-tv-zB-DF-HJ-NP-TV-Z] { consonants++; } // Match consonants (case insensitive)
.|\n { /* Ignore other characters */ }
%%
int main() {
printf("Enter text (Ctrl+D to end input):\n");
yylex(); // Start processing input
printf
("
Number of vowels
: %d\n", vowels); printf
("
Number of consonants
: %d\n", consonants); return 0;
}
int yywrap() {
return 1; // Indicate no more input
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgdm93ZWxzID0gMCwgY29uc29uYW50cyA9IDA7CiV9CgolJQoKW2FBZUVpSW9PdVVdIHsgdm93ZWxzKys7IH0gICAgICAgIC8vIE1hdGNoIHZvd2VscyAoY2FzZSBpbnNlbnNpdGl2ZSkKW2ItZGYtaGotbnAtdHYtekItREYtSEotTlAtVFYtWl0geyBjb25zb25hbnRzKys7IH0gLy8gTWF0Y2ggY29uc29uYW50cyAoY2FzZSBpbnNlbnNpdGl2ZSkKLnxcbiB7IC8qIElnbm9yZSBvdGhlciBjaGFyYWN0ZXJzICovIH0KCiUlCgppbnQgbWFpbigpIHsKICAgIHByaW50ZigiRW50ZXIgdGV4dCAoQ3RybCtEIHRvIGVuZCBpbnB1dCk6XG4iKTsKICAgIHl5bGV4KCk7IC8vIFN0YXJ0IHByb2Nlc3NpbmcgaW5wdXQKICAgIHByaW50ZigiTnVtYmVyIG9mIHZvd2VsczogJWRcbiIsIHZvd2Vscyk7CiAgICBwcmludGYoIk51bWJlciBvZiBjb25zb25hbnRzOiAlZFxuIiwgY29uc29uYW50cyk7CiAgICByZXR1cm4gMDsKfQoKaW50IHl5d3JhcCgpIHsKICAgIHJldHVybiAxOyAvLyBJbmRpY2F0ZSBubyBtb3JlIGlucHV0Cn0KCg==