Given a string, write a program to count the occurrence of Lowercase characters, Uppercase characters, Special characters and Numeric values.
Input : #GeeKs01fOr@gEEks07 Output : Upper case letters : 5 Lower case letters : 8 Numbers : 4 Special Characters : 2 Input : *GeEkS4GeEkS* Output : Upper case letters : 6 Lower case letters : 4 Numbers : 1 Special Characters : 2
Step 1: Scan a string str from 0 to length-1.
Step 2: check one character at a time on the basis of ASCII values
if(str[i] >= 65 and str[i] =97 and str[i] =48 and str[i] <=57) number
else special character
step 3: Print all the counters.
Upper case letters: 5 Lower case letters : 8 Number : 4 Special characters : 2
This article is contributed by Rishabh Jain. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Check if lowercase and uppercase characters are in same order
- Maximum distinct lowercase alphabets between two uppercase
- Program to display all alphabets from A to Z in uppercase and lowercase both
- Convert all lowercase characters to uppercase whose ASCII value is co-prime with k
- Split numeric, alphabetic and special symbols from a String
- Check input character is alphabet, digit or special character
- Count number of substrings with numeric value greater than X
- Count substrings that starts with character X and ends with character Y
- Count special palindromes in a String
- Minimize ASCII values sum after removing all occurrences of one character
- Program to count vowels, consonant, digits and special characters in string.
- Count of sub-strings that contain character X at least once
- Count the number of words having sum of ASCII values less than and greater than k
- Count characters in a string whose ASCII values are prime
- Number of substrings with count of each character as k