Pagini recente » Cod sursa (job #1910875) | Cod sursa (job #3178010) | Cod sursa (job #884688) | Cod sursa (job #2760473) | Cod sursa (job #3301460)
#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[1024], 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);
}