Last active
August 20, 2023 12:53
-
-
Save 3bugs/877b322793a8e6667870ed4f1a08496e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <ctype.h> | |
| int main() { | |
| int num; | |
| char input; | |
| int charFrequency[26] = {0}; | |
| scanf("%d", &num); | |
| for (int i = 0; i < num; ++i) { | |
| scanf(" %c", &input); | |
| input = tolower(input); | |
| charFrequency[input - 'a']++; | |
| } | |
| for (int i = 0; i < 26; ++i) { | |
| if (charFrequency[i] > 0) { | |
| printf("%c: %d\n", 'a' + i, charFrequency[i]); | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment