Compiler Design | Lex Programs to count the number of vowels and consonants in user given the input.

Compiler Design Lap Program:
%{
#include<s;stdio.h>
int vowels=0;
int cons=0;
%}
%%
[aeiouAEIOU] {vowels++;}
[a-zA-Z] {cons++;}
%%
int yywrap()
{
return 1;
}
main()
{
printf(“Enter the string.. at end press ^d\n”);
yylex();
printf(“No of vowels=%d\nNo of consonants=%d\n”,vowels,cons);
}