Consonant Counting Problem Statement
Given a string STR
comprising uppercase and lowercase characters and spaces, your task is to count the number of consonants in the string.
A consonant is defined as an English alphabet character that is not a vowel (a, e, i, o, or u). Examples of consonants include b, c, d, f, etc.
Example:
Input:
STR = 'Coding Ninjas'
Output:
8
Explanation:
The given string contains 8 consonants: 'C', 'd', 'n', 'g', 'N', 'n', 'j', 's'. These characters are not part of the vowel set.
Constraints:
1 ≤ T ≤ 50
1 ≤
Length ofSTR ≤ 104
- The string consists of uppercase and lowercase letters and spaces.
- Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
Top Optum Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app