Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define MAXLEN 12
- int main()
- {
- int c;
- int symbols[MAXLEN];
- for (int i = 0; i < MAXLEN; ++i)
- symbols[i] = 0;
- while ((c = getchar()) != EOF)
- {
- if (c == ' ' || c == '\t' || c == '\n')
- ++symbols[10];
- else if (c >= '0' && c <= '9')
- ++symbols[c - '0'];
- else
- ++symbols[11];
- }
- for (int i = 0; i < MAXLEN; ++i)
- printf("%d: %d", i, symbols[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment