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
Anonymous
1y
in such a way we can solve this and in question mentioned that not print anything. So i written in this way
for i in range(int(input())):
s=input()
n=int(input())
Help your peers!
Add answer anonymously...
Top TCS Graduate Trainee interview questions & answers
Popular interview questions of Graduate Trainee
Top HR questions asked in TCS Graduate Trainee
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