Cod sursa(job #583880)
/**
* user: caen1
* file: infoarena/text.c
* date: 23 apr 2011
**/
#include <stdio.h>
#include <ctype.h>
#define IN "text.in"
#define OUT "text.out"
int main(void) {
long len_text = 0, nr_cuv = 0, cuv = 0;
char ch;
freopen(IN, "r", stdin);
freopen(OUT, "w", stdout);
while((ch = getchar()) != EOF) {
if(!cuv && isalpha(ch)) ++nr_cuv, cuv = 1, ++len_text;
else if(cuv && isalpha(ch)) ++len_text;
else if(cuv && !isalpha(ch)) cuv = 0;
}
printf("%ld", len_text / nr_cuv);
return 0;
}