Cod sursa(job #13682)

Utilizator vmaneavmanea vmanea Data 7 februarie 2007 13:08:09
Problema Text Scor 90
Compilator c Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <ctype.h>
#include <stdio.h>
#include <string.h>

char s[5555];
int lg,i,nrcuv,t,l;

int main(void)
{
	freopen("text.in", "r", stdin);
	freopen("text.out", "w", stdout);


	while (scanf("%s", &s) != EOF)
	{
		lg = strlen(s);
		for (i = l = 0; i < lg; ++i)
			if (isalpha(s[i]))
				++l;
			else if (l)
			{
				++nrcuv;
				t += l;
				l = 0;
			}
		if (l)
		{
			++nrcuv;
			t += l;
		}
	}

	printf("%d\n", t / nrcuv);

	return 0;
}