using
System;
using
System.Globalization;
class
GFG {
static
void
countCharacterType(
string
str)
{
int
vowels = 0, consonant = 0,
specialChar = 0, digit = 0;
for
(
int
i = 0; i < str.Length; i++) {
char
ch = str[i];
if
((ch >=
'a'
&& ch <=
'z'
) ||
(ch >=
'A'
&& ch <=
'Z'
)) {
ch =
char
.ToLower(ch);
if
(ch ==
'a'
|| ch ==
'e'
|| ch ==
'i'
||
ch ==
'o'
|| ch ==
'u'
)
vowels++;
else
consonant++;
}
else
if
(ch >=
'0'
&& ch <=
'9'
)
digit++;
else
specialChar++;
}
Console.WriteLine(
"Vowels: "
+ vowels);
Console.WriteLine(
"Consonant: "
+ consonant);
Console.WriteLine(
"Digit: "
+ digit);
Console.WriteLine(
"Special Character: "
+ specialChar);
}
static
public
void
Main()
{
string
str =
"geeks for geeks121"
;
countCharacterType(str);
}
}