Given a string, print count of vowels and consonants in the string.
Posted on | Wednesday, 17 May 2023 | No Comments
Given a string, print count of vowels and consonants in the string.
Input Format
Input contains a string S, consisting of lowercase and uppercase characters.
Constraints
1 <= len(S) <= 100
Output Format
Print count of vowels and consonants in the given string, separated by space.
Sample Input 0
aBxbbiAasPw
Sample Output 0
4 7
vcount = 0;
ccount = 0;
str = input()
str = str.lower();
for i in range(0,len(str)):
if str[i] in ('a',"e","i","o","u"):
vcount = vcount + 1;
elif (str[i] >= 'a' and str[i] <= 'z'):
ccount = ccount + 1;
print(vcount,ccount);

Comments
Categories
Archives
- May 2023 (30)
Leave a Reply