Pagini recente » Rating Hodorogea Alexandru (Alex071) | Cod sursa (job #1757638) | Cod sursa (job #2710420) | Rating Tir Mihai Iulian (Tir_Mihai) | Cod sursa (job #3301461)
#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);
}