The problem is to write a program that prompts the user to enter a string and counts the number of occurrences of each letter of the string regardless of the case.
The following are the steps involved.
- Convert the String to lowercase
- Create an array of size 26 for storing the count of each letter
- Increment the count for each letter after confirming that each letter is an alphabet
Exercise: Write a program that implements the above to count each letter of a string
Enter string: ababax a appears 3 times b appears 2 times x appears 1 time
Download Code: Count Each Letter
No comments:
Post a Comment