Cod sursa(job #1189253)

Utilizator EpictetStamatin Cristian Epictet Data 21 mai 2014 23:16:30
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <cstdio>
#define Dmax 8192
using namespace std;
int nrcuv, nrchar, w, pz, prim = 1;
char c, ax[Dmax + 16];

inline void cit()
{
	if(prim) fread(ax, 1, Dmax, stdin), prim = 0;
	c = ax[pz];
	if(++pz == Dmax) fread(ax, 1, Dmax, stdin), pz = 0;
}

int main()
{
	freopen("text.in", "r", stdin);
	freopen("text.out", "w", stdout);
	cit();
	while(c != '\n')
	{
		if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) 
		{
			nrchar++;
			w++;
		}
		else
		{
			if(w) nrcuv++, w = 0;
		}
		cit();
	}
	printf("%d\n", nrchar / nrcuv);
	return 0;
}