Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- int main()
- {
- char str[50];
- int i = 0,
- count[26] = { 0 },
- b;
- printf("Enter string: ");
- scanf("%s", str);
- while (str[i] != '\0')
- {
- if (str[i] >= 'a' && str[i] <= 'z')
- {
- b = str[i] - 'a';
- count[b]++;
- }
- ++i;
- }
- for (i = 0; i < 26; ++i)
- {
- printf("%c-%d\n", i + 'a', count[i]);
- }
- getchar(); getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement