%{
int vow_count = 0;
int const_count = 0;
%}
%%
[aeiouAEIOU] { vow_count++; }
[a-zA-Z] { const_count++; }
%%
int yywrap() {
return 1;
}
int main() {
printf("Enter the string of vowels and consonants: ");
yylex();
printf
("
Number of vowels are
: %d\n", vow_count); printf
("
Number of consonants are
: %d\n", const_count);
return 0;
}
JXsKICAgIGludCB2b3dfY291bnQgPSAwOwogICAgaW50IGNvbnN0X2NvdW50ID0gMDsKJX0KIAolJQpbYWVpb3VBRUlPVV0geyB2b3dfY291bnQrKzsgfQpbYS16QS1aXSB7IGNvbnN0X2NvdW50Kys7IH0KJSUKCmludCB5eXdyYXAoKSB7CiAgICByZXR1cm4gMTsKfQoKaW50IG1haW4oKSB7CiAgICBwcmludGYoIkVudGVyIHRoZSBzdHJpbmcgb2Ygdm93ZWxzIGFuZCBjb25zb25hbnRzOiAiKTsKCiAgICB5eWxleCgpOwoKICAgIHByaW50ZigiTnVtYmVyIG9mIHZvd2VscyBhcmU6ICVkXG4iLCB2b3dfY291bnQpOwogICAgcHJpbnRmKCJOdW1iZXIgb2YgY29uc29uYW50cyBhcmU6ICVkXG4iLCBjb25zdF9jb3VudCk7CgogICAgcmV0dXJuIDA7Cn0K