LEX program to count the number of vowels and consonants in a given string
Prerequisite: Flex (Fast lexical Analyzer Generator) Given a string containing both vowels and consonants, write a LEX program to count the number of vowels and consonants in given string. Examples:
Input: Hello everyone Output: Number of vowels are: 6 Number of consonants are: 7 Input: This is GeeksforGeeks Output: Number of vowels are: 7 Number of consonants are: 12
Approach- Approach is very simple. If any vowel is found increase vowel counter, if consonant is found increase consonant counter otherwise do nothing. Below is the implementation:
My Personal Notes arrow_drop_up
Please Login to comment...