Cod sursa(job #178106)

Utilizator AndreyPAndrei Poenaru AndreyP Data 14 aprilie 2008 08:38:49
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<stdio.h>
#define N 110000
char c[N];
int main()
{
	freopen("text.in","r",stdin);
	freopen("text.out","w",stdout);
	int i,nc=0,nl=0;
	bool ok=false;
	fgets(c,N,stdin);
	for(i=0; c[i]!='\0'; i++)
	{
		if((c[i]>='A')&&(c[i]<='Z')||(c[i]>='a')&&(c[i]<='z'))
		{
			nl++;
			ok=true;
		}
		else
		{
			if(ok)
			{
				nc++;
				ok=false;
			}
		}
	}
	if(ok)
		nc++;
	printf("%d\n",nl/nc);
	return 0;
}