human
Program to count vowels , consonant , digits and special characters in string . | Function to count number of vowels , consonant , digits and special character in a string ..
Declare the variable vowels , consonant , digit and special characters.
str . length ( ) function to count number of character in given string ..
To handle upper case letters.
Driver function ."
Solution in Python:
 ... Can you provide a code to program to count vowels , consonant , digits and special characters in string?
assistant
#Here is code to program to count vowels , consonant , digits and special characters in string .
 def countCharacterType ( str ) :
	vowels = 0
	consonant = 0
	specialChar = 0
	digit = 0
	for i in range ( 0 , len ( str ) ) :
		ch = str [ i ]
		if ( ( ch >= ' a ' and ch <= ' z ' ) or ( ch >= ' A ' and ch <= ' Z ' ) ) :
			ch = ch . lower ( )
			if ( ch == ' a ' or ch == ' e ' or ch == ' i ' or ch == ' o ' or ch == ' u ' ) :
				vowels += 1
			else :
				consonant += 1
		elif ( ch >= '0' and ch <= '9' ) :
			digit += 1
		else :
			specialChar += 1
	print ( " Vowels : " , vowels )
	print ( " Consonant : " , consonant )
	print ( " Digit : " , digit )
	print ( " Special ▁ Character : " , specialChar )
str = " geeks ▁ for ▁ geeks121"
countCharacterType ( str )