GRAND ASSIGNMENT - 2 Special Characters
Special Characters
Write a program to count Vowels and Consonants in string.
Input
The input will be a single line containing a string s.
Output
The first line of output should contain no of Vowels in the given string
The second line of output should contain no of Consonants in the given string
Explanation
For example, if the given string is "Good Morning"
Vowels in the string "Good Morning" are "o, i" and their count is 4.
Remaining characters in the string are consonants their count is 7.
The First line of output is 4\nThe second line of output is 7.
Input
The input will be a single line containing a string s.
Output
The first line of output should contain no of Vowels in the given string
The second line of output should contain no of Consonants in the given string
Explanation
For example, if the given string is "Good Morning"
Vowels in the string "Good Morning" are "o, i" and their count is 4.
Remaining characters in the string are consonants their count is 7.
The First line of output is 4\nThe second line of output is 7.
Sample Input 1Sample Output 1
Good Morning
4 7
Sample Input 2Sample Output 2
welcome
3 4
inputstring=input()
vowels=0
consonant=0
inputstring=inputstring.lower()
for l in inputstring:
if (l=="a" or l=="e" or l=="i" or l=="o" or l=="u"):
vowels+=1
else:
if l !=" " and l.isdigit()==False:
consonant+=1
print(str(vowels))
print( str(consonant))
Comments
Post a Comment