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 of STR ≤ 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...
TCS Graduate Trainee Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter