Cod sursa(job #3301461)

Utilizator tavy_codingAlbuica Ioan Octavian tavy_coding Data 26 iunie 2025 17:10:43
Problema Text Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <stdio.h>
#include <string.h>

using namespace std;

int main()
{
    FILE *file_in = fopen("text.in", "r");
    FILE *file_out = fopen("text.out", "w");
    char text[1000000], delim[] = " ,.-:!?'[](){}@#$%^&*`~_+|/1234567890";
    
    int l = 0, nr = 0;
    fgets(text, sizeof(text), file_in);

    char *s = strtok(text, delim);
    while (s) {
        l += strlen(s);
        nr++;
        s = strtok(NULL, delim);
    }

    fprintf(file_out, "%d\n", l / nr);
    fclose(file_in);
    fclose(file_out);
}