Cod sursa(job #1247431)

Utilizator danny794Dan Danaila danny794 Data 22 octombrie 2014 20:14:30
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <cstdio>

#define MAX ((1 << 20) + 1)
#define good(c) (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))

using namespace std;

int sum, length;
char text[MAX];

void solve()
{
	int i = 0, sum = 0, no = 0;
	while(i < length)
	{
		if(good(text[i]))
			no++;
		while(good(text[i]))
		{
			i++;
			sum++;
		}
		i++;
	}

	printf("%d\n", sum / no);
}

void read()
{
	char c;
	freopen("text.in", "r", stdin);
	freopen("text.out", "w", stdout);
	while(scanf("%c", &c) != EOF)
	{
		text[length] = c;
		length++;
	}
}

int main()
{
	read();
	solve();
	return 0;
}