Cod sursa(job #1059638)

Utilizator daniel.amarieiDaniel Amariei daniel.amariei Data 16 decembrie 2013 20:40:06
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <stdio.h>
#include <string.h>
#include <ctype.h>

char text[10000000];
int nr_cuvinte;
int lungime;

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

	gets(text);
	int i = 0;
	while (text[i])
	{
		while (text[i] && !isalpha(text[i]))
		{
			++i;
		}

		++nr_cuvinte;

		while (text[i] && isalpha(text[i]))
		{
			++i;
			++lungime;
		}
	}

	printf("%d", lungime / nr_cuvinte);
	return 0;
}