Cod sursa(job #643032)

Utilizator AurashCucu Aurelian Aurash Data 2 decembrie 2011 19:35:31
Problema Text Scor 30
Compilator c Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char buf[10000000+1];

int main(void)
{
	double nr_cuv=0;
	double lungime_cuv=0;
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	fgets(buf,10000000,stdin);
	char *s;
	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;
}