Cod sursa(job #1189252)

Utilizator EpictetStamatin Cristian Epictet Data 21 mai 2014 23:12:27
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <cstdio>
#define Dmax 8192
using namespace std;
int nrcuv, nrchar, pz, prim = 1;
char c, last, 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++;
			if((last < 'A' || last > 'z') || (last > 'Z' && last < 'a'))
			{
				nrcuv++;
			}
		}
		last = c;
		cit();
	}
	printf("%d\n", nrchar / nrcuv);
	return 0;
}