Cod sursa(job #643043)
| Utilizator | Data | 2 decembrie 2011 19:46:15 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
char buf[1000000000+1];
int main(void)
{
char *s;
double nr_cuv=0;
double lungime_cuv=0;
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
while(fgets(buf,1000000000,stdin))
{
s=strtok(buf," ,.-;:!?01234\"\'56789");
while(s!=NULL)
{
++nr_cuv;
lungime_cuv+=strlen(s);
s=strtok(NULL," ,.-;:!?01234\"\'56789");
}
}
printf("%lf",floor(lungime_cuv/nr_cuv));
return 0;
}
