Count Number of Vowels and Number of Consonants from a String
Given a string, our task is to determine how many vowels and consonants it has.
For example:
Input: string = "pythonisawesome"
Output: vowels: 6 consonants: 9
This problem can be solved by maintaining two variables:
Thank you so much for reading this article, if you like this question please share this with your friends who love programming. And if you have questions or feedback please drop a comment.
To solve more problems, please check out this article "Top 10 String Interview Questions".
All the Best!
Comments
Post a Comment