#include #include #include #define MAX 505 int main(int argc, char* argv[]) { FILE *input = fopen(argv[1], "r"); FILE *output = fopen(argv[2], "w"); if(input == NULL) { printf("Ne e dobro!"); return 0; } char niza[MAX]; while(fgets(niza, 100, input)) { int brojac[26]; for(int i = 0; i < 26; i++) { brojac[i] = 0; } for(int i = 0; i < strlen(niza); i++) { niza[i] = tolower(niza[i]); } for(int i = 0; i < strlen(niza); i++) { brojac[niza[i] - 'a']++; } for(int i = 0; i < 26; i++) { if(brojac[i] > 0) { fprintf(output, "%c %d\n", (char)(i + 'a'), brojac[i]); } } fprintf(output, "\n"); } return 0; } /* 5 4 1 2 7 3 2 2 4 0 5 6 0 1 1 2 3 4 3 2 0 12 3 4 1 2 3 0 5 6 0 7 -1 -2 -3 12 */